@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #1e3c72;
    --secondary: #2a5298;
    --accent: #ffb74d;
    --text-dark: #333;
    --text-light: #f4f4f4;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.3);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: var(--text-dark);
}

.container {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 900px;
    overflow: hidden;
    position: relative;
}

.header {
    background: linear-gradient(to right, #1a237e, #283593);
    color: white;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.header h1 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.header p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.content {
    padding: 2rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-control:focus {
    border-color: var(--secondary);
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(42, 82, 152, 0.1);
}

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.btn {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    /* width: 100%; Removed to fix "too big" issue */
    width: auto;
    min-width: 250px;
    text-align: center;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(30, 60, 114, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.file-upload {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    background: #f8f9fa;
    transition: all 0.3s;
    cursor: pointer;
}

.file-upload:hover {
    border-color: var(--secondary);
    background: #eef2f7;
}

.file-preview {
    width: 120px;
    height: 114px;
    object-fit: cover;
    object-position: center 10%;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(255, 183, 77, 0.1);
    border-radius: 10px;
    border-left: 4px solid var(--accent);
}

.checkbox-wrapper input {
    margin-top: 0.3rem;
    accent-color: var(--primary);
    transform: scale(1.2);
}

.checkbox-wrapper label {
    font-size: 0.9rem;
    color: #444;
    line-height: 1.4;
}

/* Alert Messages */
.alert {
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ========== ADMIN DASHBOARD STYLES ========== */

/* Main Admin Container */
.admin-container {
    background: #f8fafc;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.admin-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.admin-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.admin-header-actions {
    display: flex;
    gap: 1rem;
}

/* Stats Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    padding: 2rem;
    background: #f8fafc;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--primary);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

/* Filter & Search Bar */
.admin-controls {
    padding: 1.5rem 2rem;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.filter-pills {
    display: flex;
    gap: 0.75rem;
}

.pill-btn {
    padding: 0.6rem 1.2rem;
    border: 2px solid #e2e8f0;
    background: white;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.pill-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pill-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.search-box {
    flex: 1;
    min-width: 250px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

/* Table Container */
.table-container {
    background: white;
    margin: 1.5rem 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.table-header {
    padding: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.table-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-header-badge {
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Admin Table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table thead {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
}

.admin-table th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 700;
    color: #475569;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
}

.admin-table tbody tr {
    transition: all 0.2s ease;
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

/* Status Badges */
.type-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-student {
    background: #dbeafe;
    color: #1e40af;
}

.badge-employee {
    background: #dcfce7;
    color: #166534;
}

.status-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-approved {
    background: #dcfce7;
    color: #166534;
}

.status-rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* Action Buttons */
.action-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-icon {
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: #f1f5f9;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 60, 114, 0.2);
}

.btn-outline {
    background: white;
    color: #64748b;
    padding: 0.6rem 1.2rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f8fafc;
}

.btn-secondary {
    background: #64748b;
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Modal Styles */
#reviewModal {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
}

#reviewModal .container {
    max-width: 1000px;
    margin: 2rem auto;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

#reviewModal .header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#reviewModal .content {
    padding: 2rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

.modal-footer {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.danger-zone {
    background: #fee2e2;
    border: 1px solid #fecaca;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #94a3b8;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ID Card Template - Enhanced Design */
#id-card-template {
    width: 2.2in;
    height: 3.4in;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-family: 'Arial Narrow', Arial, sans-serif;
    border: 1.5px solid #e0e0e0;
    box-sizing: border-box;
    margin-top: 12px;
    /* Subtle texture */
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.4) 1.2px, transparent 1.2px),
        radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.4) 1.2px, transparent 1.2px);
    background-size: 20px 20px;
}

.id-card-header {
    width: 100%;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #1e3c72 100%);
    padding: 3px 5px 4px 5px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-bottom: 3.5px solid #FFC107;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    margin-bottom: 1px;
    position: relative;
}

.id-card-header .logo {
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    padding: 3px;
    margin-bottom: 2px;
    border: 1px solid #FFC107;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.id-card-header h2 {
    margin: 0;
    font-size: 8.5px;
    font-weight: 800;
    text-transform: uppercase;
    color: #FFC107;
    line-height: 1.1;
    text-align: center;
    letter-spacing: 0.2px;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
}

.id-card-header h3 {
    margin: 1px 0 0 0;
    font-size: 6px;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: 0.1px;
    white-space: nowrap;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2);
}

.id-photo-container {
    margin-top: 5px;
    position: relative;
    padding: 3px;
    border: 1.5px solid #1e3c72;
    border-radius: 6px;
    display: inline-block;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.1);
}

.id-photo {
    width: 74px;
    height: 70px;
    object-fit: cover;
    object-position: center 10%;
    /* Prioritize top of the head */
    border-radius: 5px;
    display: block;
    border: 1px solid #e0e0e0;
}

.id-badge {
    position: absolute;
    top: 8px;
    right: 6px;
    background: linear-gradient(135deg, #c62828, #d32f2f);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 6.5px;
    font-weight: 800;
    z-index: 1000;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.id-name-centered {
    color: #1a237e;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    margin: 5px 0 4px 0;
    position: relative;
    z-index: 100;
    letter-spacing: 0.1px;
    text-shadow: 0.5px 0.5px 0.5px rgba(0, 0, 0, 0.1);
}

.id-details {
    width: 100%;
    padding: 0 10px 6px 10px;
    text-align: left;
    margin-top: 2px;
    flex-grow: 1;
}

.id-row {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    padding: 0.8px 0;
    border-bottom: 0.5px dotted #e0e0e0;
    line-height: 1.0;
}

.id-label {
    font-size: 8.5px;
    font-weight: 700;
    color: #1e3c72;
    width: 82px;
    flex-shrink: 0;
    text-align: left;
    letter-spacing: 0.1px;
}

.id-value {
    font-size: 10.5px;
    font-weight: 600;
    color: #111;
    text-align: left;
    line-height: 1.1;
    flex: 1;
    padding-left: 4px;
}

.id-value.emergency {
    color: #d32f2f;
    font-weight: 800;
}

.seal-container {
    position: absolute;
    bottom: -35px;
    right: -95px;
    width: 155px;
    z-index: 50;
    pointer-events: none;
    transform: rotate(-15deg);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    opacity: 0.8;
}

.id-card-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(135deg, #1e3c72, #1a237e);
    padding: 3px 2px;
    color: #ffffff;
    font-size: 4.5px;
    font-weight: 700;
    text-align: center;
    line-height: 1.1;
    text-transform: uppercase;
    z-index: 100;
    letter-spacing: 0.1px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.qr-code-container {
    position: absolute;
    bottom: 24px;
    right: 8px;
    width: auto;
    display: flex;
    justify-content: center;
    z-index: 200;
}

/* Diagonal Demo Watermark */
.demo-watermark {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-40deg);
    font-size: 45px;
    font-weight: 900;
    color: rgba(140, 140, 140, 0.65);
    pointer-events: none;
    z-index: 101;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Mobile Responsiveness */
@media screen and (max-width: 768px) {
    body {
        padding: 1rem;
        align-items: flex-start;
        /* Allow scrolling from top */
    }

    .container {
        width: 100%;
        margin-top: 1rem;
        border-radius: 12px;
    }

    .header {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .header h2 {
        font-size: 1.2rem;
    }

    .row {
        grid-template-columns: 1fr;
        /* Stack inputs vertically */
        gap: 1rem;
    }

    .btn {
        width: 100%;
        /* Full width buttons for easier tapping */
        min-width: auto;
        padding: 0.8rem;
        margin-bottom: 0.5rem;
        font-size: 1rem;
    }

    .file-upload {
        padding: 1.5rem;
    }

    /* Form controls adjustments */
    .form-control {
        padding: 0.7rem 0.9rem;
        font-size: 1rem;
    }

    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.3rem;
    }

    /* Admin specific adjustments for mobile */
    .admin-table {
        font-size: 10px;
        /* Smaller font for tables */
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
        /* 2 columns for stats instead of 4 */
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar form {
        width: 100%;
    }

    .filter-bar input[type="text"] {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }

    /* Adjust ID card preview scaling if needed */
    #id-card-template {
        transform-origin: top center;
        transform: scale(0.85);
        margin: 0 auto;
    }

    /* OTP input specific improvements */
    input[name="otp"] {
        letter-spacing: 5px !important;
        font-size: 1.5rem !important;
        padding: 0.8rem !important;
    }

    /* Content padding adjustments */
    .content {
        padding: 1.5rem;
    }
}

/* Extra small devices (phones, 480px and down) */
@media screen and (max-width: 480px) {
    body {
        padding: 0.5rem;
    }

    .container {
        margin-top: 0.5rem;
        padding: 0.5rem;
    }

    .header {
        padding: 1rem 0.5rem;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .content {
        padding: 1rem;
    }

    .form-control {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.7rem;
        font-size: 0.9rem;
    }

    /* Scale down ID card even more on very small screens */
    #id-card-template {
        transform: scale(0.75);
    }

    /* OTP input for small screens */
    input[name="otp"] {
        letter-spacing: 3px !important;
        font-size: 1.2rem !important;
        padding: 0.6rem !important;
    }
}