/* ---------- CSS RESET ---------- */
*,
*::before,
*::after {
    box-sizing: border-box
}


* {
    margin: 0
}

html,
body {
    height: 100%;
}

body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji"
}

img,
svg {
    display: block;
    max-width: 100%
}

button,
input,
select,
textarea {
    font: inherit
}

/* ---------- THEME ---------- */
:root {
    --bg: #0b0c10;
    /* page background */
    --panel: #111317;
    /* cards & sidebar */
    --muted: #94a3b8;
    /* secondary text */
    --text: #ffffff;
    /* primary text */
    --primary: #FF9933;
    /* saffron accents */
    --primary-600: #e68a2e;
    --border: rgba(255, 255, 255, 0.1);
    /* borders */
    --ring: rgba(255, 153, 51, 0.4);
    /* focus rings */
    --good: #22c55e;
    --warn: #f59e0b;
    --bad: #ef4444;
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --radius: 14px;
    --radius-sm: 12px;
    --sidebar-w: 260px;
}

body {
    background: var(--bg);
    color: var(--text);
    /* overflow: hidden; */
}

/* ---------- LAYOUT ---------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh
}

.sidebar {
    display: flex;
    flex-direction: column;
    background: color-mix(in srgb, var(--panel) 80%, transparent);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 10;
}


.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    margin-bottom: 14px
}

.brand .logo {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    /* background: linear-gradient(135deg, var(--primary), #12c2e9); */
    background: white;
    box-shadow: var(--shadow)
}

.brand strong {
    font-size: 1.4rem;
}

.nav {
    margin-top: 10px;
    display: grid;
    gap: 6px
}

.nav button, .nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.nav a:hover {
    background: color-mix(in oklab, var(--panel) 70%, var(--text) 6%);
    border-color: var(--border)
}

.nav a.active {
    /* background: color-mix(in oklab, var(--primary) 15%, transparent);
            border-color: color-mix(in oklab, var(--primary) 30%, var(--border)); */
    background: var(--primary);
}

.nav svg {
    width: 18px;
    height: 18px;
    opacity: .9
}

.collapse {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 40;
    border: none;
    background: var(--panel);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    color: var(--text)
}

.main {
    padding: 24px 22px;
    background-image: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)), url(https://sptheinteriorstudio.com/cdn/shop/files/g0b.jpg?v=1726383056&width=1445);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-color: var(--bg);
    background-attachment: fixed; /* Better for performance and mobile */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap; /* Allows wrapping on mobile */
}

.topbar h1 {
    font-size: 1.65rem;
}

.search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: color-mix(in srgb, var(--panel) 60%, transparent);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 10px 14px;
    width: 100%;
    max-width: 30rem;
    margin: 1rem 0rem;
    border: 2px solid rgba(255, 255, 255, 0.6) !important;
    /* Force visible white border globally */
}

.search input {
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    width: 100%
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin: 8px 0 18px
}

.card {
    background: color-mix(in srgb, var(--panel) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center; /* Better alignment */
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    border-color: var(--primary);
}

.card-content {
    display: flex;
    flex-direction: column;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--primary) 15%, transparent);
    color: var(--primary);
}

.card .label {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card .value {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: .2px;
    margin-top: 4px;
    color: var(--text);
}

.card .delta {
    margin-top: 6px;
    font-size: .9rem
}

.delta.good {
    color: var(--good)
}

.delta.warn {
    color: var(--warn)
}

.delta.bad {
    color: var(--bad)
}

.panel {
    background: color-mix(in srgb, var(--panel) 90%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    height: auto;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    background: var(--panel);
}

.table-wrap {
    border-radius: inherit;
    overflow: auto;
    flex: 1;
    max-height: 600px; /* Limits to approximately 7 rows and then scrolls */
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px
}

thead {
    position: sticky;
    top: 0;
    background-color: var(--panel);
    z-index: 5;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--panel);
    text-align: left;
    font-weight: 700;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    padding-top: 18px;
    padding-bottom: 18px;
}

th,
td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.2);
}

.sort {
    cursor: pointer;
    user-select: none;
    position: relative;
}

/* Remove dropdown arrows from sortable headers as requested */
/* .sort::after {
    content: "";
    margin-left: 6px;
    border: 4px solid transparent;
    border-top-color: var(--muted);
    display: inline-block;
    transform: translateY(2px)
}

.sort.asc::after {
    border-top-color: transparent;
    border-bottom-color: var(--muted);
    transform: translateY(-2px)
} */

.sort:hover {
    color: var(--primary);
}

.btn-view {
    background: var(--primary);
    color: white;
    border-radius: 8px;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
}

.btn-view:hover {
    background: var(--primary-600);
    transform: translateY(-1px);
}

footer {
    color: var(--muted);
    font-size: .9rem;
    padding: 14px;
    margin-top: 24px;
}

.developed-by {
    margin-top: auto; /* PUSHES IT TO BOTTOM */
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.developed-by a {
    display: flex;
    flex-direction: column;
    align-items: center;      /* horizontal center */
    justify-content: center;  /* vertical center */
    gap: 8px;
    text-decoration: none;
    color: var(--muted);
    font-size: 0.8rem;
    text-align: center;
    transition: color 0.2s ease;
}

.developed-by a:hover {
    color: var(--text);
}

.developed-by img {
    height: 26px; /* slightly larger, cleaner */
    opacity: 0.85;
}


.developed-by strong {
    color: var(--text);
    font-weight: 600;
}

.filters {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.filter-select {
    background: #000 !important; /* Force black background */
    border: 1px solid var(--border);
    color: #fff !important; /* Force white text */
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    outline: none;
}

.filter-select option {
    background: #000;
    color: #fff;
}

/* User Info Utility (Used in Attendance and Birthdays) */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}

.placeholder-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #d97706);
    display: grid;
    place-items: center;
    font-weight: bold;
    color: white;
}

@media (max-width: 600px) {
    .user-info {
        gap: 8px;
    }
    .user-avatar, .placeholder-avatar {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 880px) {
    /* Hide non-essential columns in Dashboard on mobile */
    #ordersTable th:nth-child(4), #ordersTable td:nth-child(4), /* Contact */
    #ordersTable th:nth-child(5), #ordersTable td:nth-child(5)  /* Email */
    {
        display: none;
    }
    
    #ordersTable td {
        white-space: nowrap; /* Prevent date wrapping */
    }

    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        width: 280px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .collapse {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .main {
        padding: 80px 14px 24px;
        overflow-x: hidden; /* Prevent horizontal scroll on main body */
    }

    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-top: 20px;
    }
    
    .topbar h1 {
        font-size: 1.8rem;
    }

    .cards {
        grid-template-columns: 1fr; /* Force 1 column on mobile */
        gap: 16px;
    }

    .search-filter-container {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search {
        max-width: none;
        margin: 0;
    }

    .filters {
        width: 100%;
        display: flex;
        gap: 10px;
    }

    .filter-select {
        flex: 1;
        min-width: 0; /* Allow shrinking */
    }

    .panel-header {
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
        padding: 16px;
    }

    .panel-header div {
        display: flex;
        gap: 10px;
        justify-content: space-between;
    }

    .panel-header button {
        flex: 1;
        padding: 12px !important;
        font-size: 0.85rem !important;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .login-container {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        min-height: 100vh !important;
        padding: 60px 28px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        border: none !important;
        box-shadow: none !important;
        background: rgba(10, 10, 10, 0.95) !important;
    }

    .login-container h1 {
        font-size: 3.2rem !important;
        margin-bottom: 8px !important;
        letter-spacing: -0.5px;
    }

    .login-container p {
        font-size: 1.2rem !important;
        margin-bottom: 40px !important;
    }

    .form-group {
        margin-bottom: 24px !important;
    }

    .form-group label {
        font-size: 1.2rem !important;
        margin-bottom: 10px !important;
    }

    .form-control {
        padding: 20px 18px !important;
        font-size: 1.25rem !important;
        border-radius: 14px !important;
    }

    .button {
        padding: 22px !important;
        font-size: 1.4rem !important;
        margin-top: 28px !important;
        border-radius: 16px !important;
    }

    .main {
        padding: 75px 12px 20px;
    }

    .card {
        padding: 16px;
    }
    
    .card .value {
        font-size: 1.6rem;
    }

    .modal {
        width: 95%;
        margin: 0 auto;
        padding: 24px 16px;
    }

    .input {
        flex-direction: column;
        gap: 12px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-footer div {
        width: 100%;
        display: flex;
        gap: 8px;
    }

    .attendance-label {
        display: block !important;
        text-align: center;
        padding: 12px !important;
    }

    .status-group {
        flex-direction: column;
        width: 100%;
    }

    /* Hide SL No. column precisely for birthday page, but not if it's the empty state message */
    .bdy-table th:first-child,
    .bdy-table td:first-child:not([colspan]) {
        display: none;
    }
}

/* Global High-Visibility Borders for Inputs & Filters */
.filter-select,
.date-picker-wrap,
.search {
    border: 2px solid rgba(255, 255, 255, 0.6) !important;
}

/* Enhance Save Attendance Button globally if used elsewhere, or just generic button enhancement */
.button-highlight {
    background: linear-gradient(135deg, #FF9933 0%, #ff7700 100%) !important;
    box-shadow: 0 4px 15px rgba(255, 153, 51, 0.4) !important;
    transform: scale(1.02);
    border: 2px solid white !important;
}

/* ------- Custom Scrollbar--------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/*------- FORM DESIGN ----------*/

.containerForm {
    width: 100%;
    height: auto;
    background-color: #000000ab;
    border-radius: 7px;
    padding: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
}

.input {
    margin: 0.8rem 0;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.box {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.box:focus {
    border-color: var(--primary);
}

select.box option {
    background: #1d1c1c;
    color: white;
}

/* Ensure filter select options also have correct colors */
.filter-select option {
    background: #1d1c1c;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.6) !important;
    /* Force visible white border */
}

.needsCentering {
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

p {
    color: white;
    font-weight: 700;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.button {
    display: block;
    width: 100%;
    margin-top: 1rem;
    padding: 0.8rem;
    background-color: var(--primary);
    color: white;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.input span {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--muted);
    width: 100%;
    display: block;
}