:root {
    --primary-green: #006837;
    --light-green: #22b14c;
    --white: #ffffff;
    --gray-bg: #f4f7f6;
    --dark-bg: #121212;
    --dark-card: #1e1e1e;
    --accent: #ffd700;
    --text-main: #333;
    --transition: all 0.3s ease;
    --glass: rgba(255, 255, 255, 0.7);
    --shadow: 0 8px 32px 0 rgba(0, 104, 55, 0.1);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    scroll-behavior: smooth; -webkit-tap-highlight-color: transparent;
}

body { background-color: var(--gray-bg); color: var(--text-main); overflow-x: hidden; }

/* Navbar */
.navbar {
    background: var(--primary-green);
    color: white;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-area { display: flex; align-items: center; gap: 10px; }
.logo-area img { height: 40px; border-radius: 50%; border: 1.5px solid white; }
.navbar h1 { font-size: 1.2rem; letter-spacing: 1px; }
.nav-links { display: none; }

/* Main Sections */
.section { display: none; padding: 20px 5% 100px; animation: fadeIn 0.4s ease-out; }
.section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* App Cards */
.app-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-top: 10px; }
.app-card.featured {
    background: linear-gradient(135deg, var(--primary-green), #004d2a);
    color: white;
    padding: 40px 25px;
    text-align: left;
    flex-direction: row;
    gap: 20px;
}
.app-card.featured i { color: var(--accent); font-size: 3rem; margin: 0; }
.app-card.featured h3 { color: white; font-size: 1.5rem; }
.app-card.featured p { color: rgba(255,255,255,0.8); }

.app-card {
    background: var(--white);
    padding: 25px;
    border-radius: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.3);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.app-card:active { transform: scale(0.96); }
.app-card i { font-size: 2.5rem; color: var(--primary-green); margin-bottom: 15px; display: block; }
.app-card h3 { font-size: 1.3rem; color: var(--primary-green); margin-bottom: 8px; }
.app-card p { font-size: 0.9rem; color: #666; }

.card {
    background: var(--white);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    max-width: 800px;
    background: var(--glass);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0 auto;
}

.card h2 { margin-bottom: 25px; border-bottom: 2px solid var(--primary-green); padding-bottom: 10px; }

/* Forms */
.student-info, .form-group { margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
input, select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-top: 5px;
    background: rgba(255, 255, 255, 0.7);
    outline: none;
}
input:focus { border-color: var(--primary-green); }

/* Course Table */
.course-row { display: grid; grid-template-columns: 3fr 1fr 1fr 40px; gap: 10px; margin-bottom: 10px; }
.course-row.header { font-weight: bold; color: var(--primary-green); }
.btn-remove { color: #e74c3c; cursor: pointer; border: none; background: none; font-size: 1.2rem; }

/* Buttons */
.btn-primary { background: var(--primary-green); color: white; border: none; padding: 12px 25px; border-radius: 8px; cursor: pointer; transition: var(--transition); }
.btn-primary:hover { background: var(--light-green); transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
.btn-secondary { background: var(--white); border: 2px solid var(--primary-green); color: var(--primary-green); padding: 10px 25px; border-radius: 8px; cursor: pointer; }
.btn-add { background: #eee; border: none; padding: 8px 15px; border-radius: 5px; cursor: pointer; margin-bottom: 20px; transition: var(--transition); }
.btn-add:hover { background: #ddd; transform: scale(1.02); }
.btn-download { background: #2d3436; color: white; border: none; padding: 12px 25px; border-radius: 8px; cursor: pointer; margin-top: 15px; transition: var(--transition); }
.btn-download:hover { background: #555; transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.2); }

/* Footer and Social Icons */
.footer {
    padding: 40px 5% 120px; /* Extra bottom padding for mobile nav */
    text-align: center;
    background: transparent;
}
.footer-credits {
    margin-top: 15px;
    font-size: 0.85rem;
    color: #777;
    line-height: 1.6;
}
.social-icons { display: flex; justify-content: center; gap: 25px; margin-bottom: 20px; }
.social-icons a { font-size: 1.5rem; color: var(--primary-green); transition: var(--transition); }
.social-icons a:hover { color: var(--accent); transform: translateY(-3px); }

/* Results */
#result-display { text-align: center; margin-top: 30px; padding: 20px; background: rgba(240, 255, 244, 0.8); border-radius: 10px; backdrop-filter: blur(5px); }
.remark { font-style: italic; color: #555; margin: 10px 0; }

.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-top: 25px; }
.res-card { background: white; padding: 15px; border-radius: 10px; border: 1px solid #eee; text-align: center; }
.res-card.highlight { background: var(--primary-green); color: white; }

/* Admin Dashboard */
.admin-theme { background-color: var(--dark-bg); color: white; min-height: 100vh; padding: 0; }
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--dark-card); padding: 20px; border-right: 1px solid #333; }
.sidebar nav button {
    display: block; width: 100%; text-align: left; padding: 12px; background: none; border: none;
    color: #aaa; cursor: pointer; font-size: 1rem; margin-bottom: 5px; border-radius: 5px;
}
.sidebar nav button:hover, .sidebar nav button.active { background: #333; color: white; }
.sidebar nav button.logout { margin-top: 50px; color: #ff7675; }

.admin-content { flex: 1; padding: 30px; background: var(--dark-bg); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 20px 0; }
.stat-card { background: var(--dark-card); padding: 20px; border-radius: 10px; text-align: center; border-left: 4px solid var(--light-green); }
.stat-card h3 { font-size: 0.9rem; color: #888; }
.stat-card p { font-size: 1.5rem; font-weight: bold; margin-top: 5px; }

.chart-container { background: var(--dark-card); padding: 20px; border-radius: 10px; margin-top: 30px; }

#trans-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
#trans-table th { text-align: left; padding: 12px; color: #888; border-bottom: 1px solid #333; }
#trans-table td { padding: 12px; border-bottom: 1px solid #222; }

/* Switches */
.control-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; background: var(--dark-card); border-radius: 10px; margin-bottom: 10px; }
.switch { position: relative; display: inline-block; width: 50px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #444; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--light-green); }
input:checked + .slider:before { transform: translateX(26px); }

/* Modal */
.modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); }
.modal-content { background: white; margin: 15% auto; padding: 30px; width: 300px; border-radius: 10px; text-align: center; }
.modal-content h3 { margin-bottom: 15px; }
.modal-content input { margin-bottom: 15px; }
.modal-content .btn-text { background: none; border: none; color: var(--primary-green); cursor: pointer; margin-top: 10px; }
.modal-content .btn-text:hover { text-decoration: underline; }

/* Bottom Mobile Navigation */
.bottom-nav {
    display: flex;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: rgba(0, 104, 55, 0.9);
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    z-index: 1000;
    justify-content: space-around;
    padding: 12px 10px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.bottom-nav .nav-item {
    display: flex; flex-direction: column; align-items: center;
    color: rgba(255,255,255,0.6); text-decoration: none;
    font-size: 0.7rem; transition: var(--transition);
    padding: 8px; border-radius: 15px;
    flex: 1;
}
.bottom-nav .nav-item i {
    font-size: 1.3rem;
    margin-bottom: 3px;
}
.bottom-nav .nav-item.active,
.bottom-nav .nav-item:hover {
    color: var(--accent);
    transform: translateY(-5px);
}
.bottom-nav .nav-item.active i {
    text-shadow: 0 0 10px var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar .nav-links { display: none; } /* Hide top nav links on mobile */
    .navbar { justify-content: center; } /* Center logo on mobile */
    .grid-2, .stats-grid { grid-template-columns: 1fr; }
    .admin-layout { flex-direction: column; }
    .sidebar { width: 100%; border-bottom: 1px solid #333; }
    .bottom-nav { display: flex; } /* Show bottom nav on mobile */
    main { padding-bottom: 80px; } /* Add space for bottom nav */
}

#result-display button {
    margin: 5px;
}

.hidden { display: none !important; }

.qr-box {
    margin: 20px auto;
    display: flex;
    justify-content: center;
    background: white;
    padding: 10px;
    width: fit-content;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.court-container {
    height: calc(100vh - 200px); /* Adjust for navbar and bottom nav spacing */
    width: 100%;
    overflow: hidden;
    position: relative;
    border-radius: 15px;
    box-shadow: var(--shadow);
    background: white;
}

.court-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: var(--primary-green);
    z-index: 10;
}