:root {
    --gold: #D4AF37;
    --gold-light: #F4C430;
    --black: #121212;
    --dark-grey: #1E1E1E;
    --white: #F5F5F5;
    --danger: #ff4444;
    --success: #00C851;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Lato', sans-serif;
    background-color: var(--black);
    color: var(--white);
    line-height: 1.6;
}

h1,
h2,
h3 {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    margin-bottom: 20px;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--gold-light);
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Nav */
.admin-nav {
    background: var(--dark-grey);
    border-bottom: 1px solid var(--gold);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-nav .logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--gold);
}

.admin-nav ul {
    list-style: none;
    display: flex;
    gap: 20px;
}

.menu-toggle,
.close-menu {
    display: none;
}

/* Content */
.content {
    flex: 1;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* Forms */
.auth-container {
    max-width: 400px;
    margin: 4rem auto;
    background: var(--dark-grey);
    padding: 2rem;
    border: 1px solid var(--gold);
    border-radius: 8px;
    text-align: center;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--gold);
}

input[type="text"],
input[type="password"],
input[type="file"] {
    width: 100%;
    padding: 10px;
    background: #000;
    border: 1px solid var(--gold);
    color: var(--white);
    border-radius: 4px;
}

.btn {
    background: var(--gold);
    color: #000;
    padding: 10px 20px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: background 0.3s;
}

.btn:hover {
    background: var(--gold-light);
}

.alert {
    padding: 10px;
    background: rgba(255, 68, 68, 0.2);
    border: 1px solid var(--danger);
    color: var(--danger);
    margin-bottom: 10px;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--dark-grey);
    padding: 1.5rem;
    border-left: 4px solid var(--gold);
    border-radius: 4px;
}

.stat-card h3 {
    font-size: 1rem;
    margin-bottom: 5px;
    color: #888;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--white);
}

/* Guest List Table */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--dark-grey);
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #333;
}

th {
    background-color: #000;
    color: var(--gold);
}

tr:hover {
    background-color: #2a2a2a;
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {

    /* Navigation Drawer */
    .admin-nav {
        /* Keep header layout flat, but allow absolute pos for menu */
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: relative;
    }

    .menu-toggle {
        display: block;
        font-size: 2rem;
        cursor: pointer;
        color: var(--gold);
    }

    .admin-nav ul {
        position: fixed;
        top: 0;
        right: -100%;
        /* Hidden by default */
        width: 250px;
        height: 100vh;
        background: var(--dark-grey);
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 60px;
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
        z-index: 1001;
    }

    .admin-nav ul.active {
        right: 0;
    }

    .close-menu {
        display: block;
        position: absolute;
        top: 20px;
        right: 20px;
        font-size: 1.2rem;
        cursor: pointer;
        color: #888;
        border-bottom: 1px solid #333;
        width: auto;
        padding-bottom: 5px;
    }

    .admin-nav ul li a {
        display: block;
        padding: 15px 20px;
        border-bottom: 1px solid #333;
        font-size: 1.1rem;
        background: transparent;
    }

    .content {
        padding: 1rem;
    }

    /* Scanner UI Mobile */
    .scanner-controls {
        display: flex;
        flex-direction: column;
        gap: 15px;
        margin-top: 20px;
    }

    .scanner-btn {
        padding: 15px;
        font-size: 1.1rem;
        border: 2px solid var(--gold);
        background: transparent;
        color: var(--gold);
        border-radius: 8px;
        cursor: pointer;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }

    .scanner-btn.primary {
        background: var(--gold);
        color: black;
        font-weight: bold;
    }

    .scanner-btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

    /* Hide File Input but show label as button */
    #qr-infile {
        display: none;
    }

    /* Stack Header Actions */
    h1 {
        font-size: 1.5rem;
    }

    /* Responsive Table (Card View) */
    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
    }

    thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    tr {
        margin-bottom: 20px;
        border: 1px solid var(--gold);
        border-radius: 8px;
        background: var(--dark-grey);
        padding: 10px;
    }

    td {
        border: none;
        position: relative;
        padding: 10px;
        text-align: left;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        border-bottom: 1px solid #333;
    }

    td:last-child {
        border-bottom: none;
        display: block;
        padding-left: 10px;
    }

    /* Labels */
    td:nth-of-type(1):before,
    td:nth-of-type(2):before,
    td:nth-of-type(3):before,
    td:nth-of-type(4):before {
        font-size: 0.85rem;
        color: #888;
        margin-bottom: 5px;
        text-transform: uppercase;
        font-weight: normal;
    }

    td:nth-of-type(1):before {
        content: "Name";
        color: var(--gold);
    }

    td:nth-of-type(2):before {
        content: "Mobile";
        font-weight: bold;
        color: var(--gold);
    }

    td:nth-of-type(3):before {
        content: "Code";
        font-weight: bold;
        color: var(--gold);
    }

    td:nth-of-type(4):before {
        content: "Status";
        font-weight: bold;
        color: var(--gold);
    }

    /* Guest List Header Actions */
    .guest-list-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 15px;
    }

    .guest-list-header form {
        flex-direction: column;
        align-items: stretch !important;
    }

    .guest-list-header input[type="file"] {
        width: 100% !important;
    }

    /* Buttons */
    .btn,
    .btn-sm {
        width: 100%;
        display: block;
        text-align: center;
        margin-bottom: 5px;
        padding: 12px;
    }

    /* Side-by-Side Button Groups */
    .btn-group-mobile {
        display: flex;
        gap: 10px;
        width: 100%;
        margin-bottom: 5px;
    }

    .btn-group-mobile .btn-sm {
        flex: 1;
        /* Equal Width */
        width: auto;
        /* Reset block width */
        margin-bottom: 0;
    }

    .btn-group-mobile form {
        flex: 1;
        display: flex;
        /* Ensure form takes space */
    }
}