/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0097a7 0%, #00838f 100%);
    background-attachment: fixed;
    background-size: cover;
    min-height: 100vh;
    line-height: 1.6;
    color: #333;
    padding-top: env(safe-area-inset-top);
}

/* ===== Container ===== */
.container {
    width: 90%;
    margin: 0 auto;
    padding: 20px 0;
    padding-top: max(20px, env(safe-area-inset-top));
    min-height: calc(100vh - 140px);
}

section {
    padding: 0;
}

/* ===== Navigation ===== */
.navbar {
    background: linear-gradient(135deg, #004d54 0%, #00616d 100%);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    margin-bottom: 30px;
    position: sticky;
    top: 0;
    z-index: 1200;
    padding-top: env(safe-area-inset-top);
}

.nav-container {
    width: 90%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 22px;
    flex-wrap: wrap;
    gap: 16px;
    position: relative;
}

.nav-brand-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-brand {
    font-size: 24px;
    font-weight: 800;
    color: #e0f2f1;
    text-decoration: none;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
}

.nav-brand:hover {
    color: #26c6da;
}

.nav-brand::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #26c6da;
    box-shadow: 0 0 12px rgba(38, 198, 218, 0.7);
}

.nav-menu {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    gap: 0;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.nav-menu li {
    display: flex;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: #dbeafe;
    padding: 10px 14px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 600;
    letter-spacing: 0.2px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #26c6da;
    box-shadow: inset 0 0 0 1px rgba(38, 198, 218, 0.3);
}

.logout-btn {
    color: #ff6b6b !important;
    background: rgba(255, 107, 107, 0.12) !important;
    box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.35) !important;
}

.logout-btn:hover {
    background: rgba(255, 107, 107, 0.25) !important;
}

.nav-login-btn {
    background: #26c6da !important;
    color: white !important;
    border-radius: 8px !important;
    border: none !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    transition: all 0.3s ease !important;
}

.nav-login-btn:hover {
    background: #00838f !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 152, 167, 0.3) !important;
}

/* ===== Burger Button ===== */
.burger {
    display: none !important;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 6px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    cursor: pointer;
    z-index: 1300;
    flex-shrink: 0;
}
.burger span {
    display: block;
    height: 2px;
    background: #e0f2f1;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.25s ease, width 0.25s ease;
    transform-origin: center;
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

nav, header {
    background: linear-gradient(135deg, #004d54 0%, #00616d 100%) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    padding: 16px 20px !important;
    position: sticky;
    top: 0;
    z-index: 1000;
}

nav a, header a {
    color: #e0f2f1 !important;
    text-decoration: none;
    transition: all 0.2s ease;
}

nav a:hover, header a:hover {
    color: #26c6da !important;
}

/* ===== Page Header ===== */
h1, h2, h3 {
    color: #004d54;
    font-weight: 700;
    letter-spacing: 0.5px;
}

h1 {
    font-size: 32px;
    margin-bottom: 10px;
}

h2 {
    font-size: 26px;
    margin-bottom: 20px;
    margin-top: 30px;
}

h3 {
    font-size: 22px;
    margin-bottom: 15px;
}

h4 {
    font-size: 18px;
    color: #00838f;
    font-weight: 600;
    margin-bottom: 12px;
}

/* ===== Dashboard Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.3s ease;
    border-left: 4px solid #26c6da;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #26c6da 0%, #00838f 100%);
}

.stat-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-left-width: 6px;
}

.stat-icon {
    font-size: 44px;
    line-height: 1;
}

.stat-content h3 {
    color: #00838f;
    font-size: 13px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    font-weight: 600;
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: #26c6da;
    line-height: 1;
}

.stat-card.highlight {
    background: linear-gradient(135deg, #e0f7fa 0%, #b2ebf2 100%);
    border-left-color: #00838f;
}

.stat-card.highlight .stat-number {
    color: #00838f;
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #e0f2f1;
    color: #00838f;
}

.badge-primary {
    background: #b3e5fc;
    color: #006064;
}

.badge-success {
    background: #c8e6c9;
    color: #2e7d32;
}

.badge-warning {
    background: #ffe0b2;
    color: #f57c00;
}

.badge-danger {
    background: #ffcdd2;
    color: #c62828;
}

/* ===== Buttons ===== */
button, a[role="button"] {
    background: #26c6da !important;
    color: white !important;
    border-radius: 8px !important;
    border: none !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-decoration: none !important;
}

button:hover, a[role="button"]:hover {
    background: #00838f !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 152, 167, 0.3) !important;
}

button:active, a[role="button"]:active {
    transform: translateY(0);
}

button.secondary, a[role="button"].secondary {
    background: #0097a7 !important;
}

button.secondary:hover, a[role="button"].secondary:hover {
    background: #00616d !important;
}

button.danger {
    background: #ef5350 !important;
}

button.danger:hover {
    background: #e53935 !important;
}

button.success {
    background: #66bb6a !important;
}

button.success:hover {
    background: #4caf50 !important;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Forms ===== */
form {
    background: white;
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #004d54;
    font-weight: 600;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #b2dfdb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #26c6da;
    box-shadow: 0 0 0 3px rgba(38, 198, 218, 0.1);
    background: #f0fffe;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

table thead {
    background: linear-gradient(135deg, #0097a7 0%, #00838f 100%);
    color: white;
}

table thead th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

table tbody tr {
    border-bottom: 1px solid #e0f2f1;
    transition: background 0.2s ease;
}

table tbody tr:hover {
    background: #f0fffe;
}

table tbody td {
    padding: 14px 16px;
    color: #333;
}

table tbody tr:last-child {
    border-bottom: none;
}

/* ===== Alerts ===== */
.alert {
    padding: 16px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    border-left: 4px solid;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.alert-success {
    background: #c8e6c9;
    color: #2e7d32;
    border-left-color: #4caf50;
}

.alert-danger {
    background: #ffcdd2;
    color: #c62828;
    border-left-color: #ef5350;
}

.alert-warning {
    background: #ffe0b2;
    color: #e65100;
    border-left-color: #ffa726;
}

.alert-info {
    background: #b3e5fc;
    color: #006064;
    border-left-color: #29b6f6;
}

/* ===== Muted Text ===== */
.muted {
    color: #555555 !important;
    font-size: 14px;
}

/* ===== Responsive Grid ===== */
@media (max-width: 968px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .burger {
        display: flex !important;
    }

    .nav-container {
        flex-wrap: nowrap;
        align-items: center;
        gap: 12px;
    }

    .nav-brand-section {
        flex: 1;
        min-width: 0;
        transition: opacity 0.15s;
    }

    .nav-container.menu-open .nav-brand-section {
        display: none;
    }

    .nav-brand {
        font-size: 18px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        width: 100%;
        order: 3;
        background: linear-gradient(135deg, #003d44 0%, #004d54 100%);
        border-top: 1px solid rgba(255,255,255,0.1);
        padding: 8px 0 12px;
        gap: 0;
    }

    .nav-menu.open {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
        border-left: none !important;
        padding-left: 0 !important;
    }

    .nav-menu a,
    .nav-menu .logout-btn,
    .nav-menu .nav-login-btn {
        width: 100%;
        padding: 12px 22px !important;
        border-radius: 0 !important;
        box-sizing: border-box;
        justify-content: flex-start;
    }

    .nav-menu li span[style] {
        display: none;
    }

    .nav-menu li:has(span) form {
        width: 100%;
    }
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    .container {
        padding: 12px;
    }

    button, a[role="button"] {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== Section Box ===== */
.section-box {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 28px;
    border-left: 4px solid #26c6da;
}

.section-title {
    color: #004d54;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===== Links ===== */
a {
    color: #26c6da;
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: #00838f;
    text-decoration: underline;
}

/* ===== Utility Classes ===== */
.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-success {
    color: #2e7d32;
    font-weight: 600;
}

.text-danger {
    color: #c62828;
    font-weight: 600;
}

.text-warning {
    color: #f57c00;
    font-weight: 600;
}

.text-info {
    color: #0097a7;
    font-weight: 600;
}

/* ===== Flex Utilities ===== */
.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-gap {
    gap: 16px;
}

.flex-wrap {
    flex-wrap: wrap;
}

/* ===== Select/Dropdown Styling ===== */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: 12px 14px;
    padding-right: 40px;
    border: 2px solid #b2dfdb;
    border-radius: 8px;
    background-color: white;
    color: #004d54;
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300838f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
}

select:hover {
    border-color: #26c6da;
    box-shadow: 0 0 0 3px rgba(38, 198, 218, 0.1);
}

select:focus {
    outline: none;
    border-color: #26c6da;
    box-shadow: 0 0 0 3px rgba(38, 198, 218, 0.2);
    background-color: #f0fffe;
}

select:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
}

select option {
    padding: 10px;
    background-color: white;
    color: #004d54;
    border-radius: 4px;
}

select option:hover {
    background: linear-gradient(135deg, #26c6da 0%, #00838f 100%);
    color: white;
}

select option:checked {
    background: linear-gradient(135deg, #26c6da 0%, #00838f 100%);
    color: white;
}

/* ===== Small Select Variants ===== */
select[style*="width:8em"] {
    width: 100% !important;
    max-width: 140px;
}

/* Division Selector Styling */
select[name="division_id"] {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dbeafe' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    border-color: #e0f2f1 !important;
    background-color: rgba(51, 65, 85, 0.6) !important;
    color: #dbeafe !important;
}

select[name="division_id"]:hover {
    border-color: #26c6da !important;
    background-color: rgba(51, 65, 85, 0.8) !important;
    box-shadow: 0 0 0 3px rgba(38, 198, 218, 0.2) !important;
}

select[name="division_id"] option {
    background-color: white;
    color: #333;
}

/* ===== Form Group Select Styling ===== */
.form-group select {
    width: 100%;
}

/* ===== Responsive Select ===== */
@media (max-width: 600px) {
    select {
        padding: 10px 12px;
        padding-right: 36px;
        font-size: 16px;
        background-size: 18px;
    }
}
