/* Custom Premium CSS System for Swaaha ID Generator */

:root {
    --primary-color: #1a330e;      /* Deep Forest Green */
    --accent-color: #3a8a27;       /* Vibrant Emerald Green */
    --accent-light: #8ec155;       /* Light Accent Lime */
    --bg-light: #f4f7f3;           /* Minty light background */
    --card-bg-mint: #DEEDE0;       /* Solid light mint from templates */
    --dark-charcoal: #1c2813;      /* Text Dark */
    --secondary-green: #5c7050;    /* Text Secondary */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-premium: 0 8px 32px 0 rgba(28, 40, 19, 0.08);
    --shadow-hover: 0 12px 48px 0 rgba(58, 138, 39, 0.15);
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    --transition-smooth: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-light);
    color: var(--dark-charcoal);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background animated glow orbs */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.4;
    pointer-events: none;
    transition: var(--transition-smooth);
}
.bg-glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%);
    top: -200px;
    right: -100px;
}
.bg-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    bottom: -150px;
    left: -150px;
}

/* Typography settings */
h1, h2, h3, .sidebar-brand {
    font-family: 'Outfit', sans-serif;
}

/* Common UI Elements */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
    border-radius: var(--border-radius-lg);
}

/* VIEW SECTIONS */
.view-section {
    display: none;
    min-height: 100vh;
    width: 100vw;
}
.view-section.active {
    display: flex;
}

/* --- 2. LOGIN STYLES --- */
#login-view {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #102409 0%, #1c3d10 50%, #2f6120 100%);
    position: relative;
    overflow: hidden;
}

#login-view::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(142, 193, 85, 0.08) 0%, transparent 60%);
    top: -50%;
    left: -50%;
    animation: rotate-bg 20s linear infinite;
    z-index: 1;
}

@keyframes rotate-bg {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.login-card {
    width: 420px;
    padding: 40px;
    position: relative;
    z-index: 10;
    background: rgba(18, 35, 12, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    color: #fff;
    backdrop-filter: blur(20px);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo-circle {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-color) 100%);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    color: #fff;
    margin-bottom: 15px;
    box-shadow: 0 8px 20px rgba(58, 138, 39, 0.4);
}

.login-header h2 {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.login-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    margin-top: 5px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.85);
}

#login-view label {
    color: rgba(255, 255, 255, 0.75);
}

.form-group input, 
.form-group select, 
.form-group textarea {
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition-smooth);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-light);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 12px rgba(142, 193, 85, 0.25);
}

/* Form Styles inside Dashboard (light theme) */
#dashboard-view .form-group label {
    color: var(--dark-charcoal);
    font-weight: 600;
}
#dashboard-view .form-group input, 
#dashboard-view .form-group select, 
#dashboard-view .form-group textarea {
    border: 1px solid rgba(28, 40, 19, 0.15);
    background: #fff;
    color: var(--dark-charcoal);
}
#dashboard-view .form-group input:focus, 
#dashboard-view .form-group select:focus, 
#dashboard-view .form-group textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(58, 138, 39, 0.15);
}
#dashboard-view .form-group input::placeholder {
    color: #aaa;
}

.btn {
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-color) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(58, 138, 39, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(58, 138, 39, 0.45);
}

.btn-secondary {
    background: rgba(28, 40, 19, 0.06);
    color: var(--dark-charcoal);
}
.btn-secondary:hover {
    background: rgba(28, 40, 19, 0.12);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--accent-color);
    color: var(--accent-color);
}
.btn-outline:hover {
    background: var(--accent-color);
    color: #fff;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    font-size: 13px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.alert-danger {
    background: rgba(220, 53, 69, 0.12);
    color: #ff6b76;
    border: 1px solid rgba(220, 53, 69, 0.2);
}

/* --- 3. DASHBOARD MAIN LAYOUT --- */
#dashboard-view {
    display: none;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}
#dashboard-view.active {
    display: flex;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
}

.sidebar-brand {
    padding: 24px;
    font-size: 22px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.text-accent {
    color: var(--accent-light);
}

.sidebar-menu {
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.menu-item {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    font-size: 14px;
    transition: var(--transition-smooth);
}

.menu-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.menu-item:hover, .menu-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}
.menu-item.active {
    background: linear-gradient(90deg, rgba(142, 193, 85, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    border-left: 3px solid var(--accent-light);
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    padding-left: 13px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--accent-light);
}
.user-details {
    display: flex;
    flex-direction: column;
}
#user-display-name {
    font-size: 13px;
    font-weight: 600;
}
.user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.btn-logout {
    color: rgba(255, 255, 255, 0.6);
    background: transparent;
    padding: 8px;
    font-size: 18px;
    border-radius: 50%;
}
.btn-logout:hover {
    color: #ff6b76;
    background: rgba(255, 107, 118, 0.1);
}

/* Main Workspace Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    position: relative;
    z-index: 5;
}

.content-header {
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(28, 40, 19, 0.08);
    background: rgba(244, 247, 243, 0.7);
    backdrop-filter: blur(5px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-title h1 {
    font-size: 26px;
    font-weight: 800;
}
.header-title p {
    font-size: 13px;
    color: var(--secondary-green);
    margin-top: 2px;
}

.tab-panel {
    display: none;
    padding: 40px;
    animation: fade-in 0.4s ease forwards;
}
.tab-panel.active {
    display: block;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- OVERVIEW TAB --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}
.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}
.bg-green-light { background: rgba(58, 138, 39, 0.1); color: var(--accent-color); }
.bg-blue-light { background: rgba(142, 193, 85, 0.1); color: var(--primary-color); }
.bg-gold-light { background: rgba(220, 180, 53, 0.1); color: #d4a017; }

.stat-info h3 {
    font-size: 14px;
    color: var(--secondary-green);
    font-weight: 500;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
}

.overview-section {
    padding: 32px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.section-header h2 {
    font-size: 20px;
    font-weight: 700;
}
.btn-link {
    background: transparent;
    color: var(--accent-color);
    padding: 4px 8px;
    font-size: 13px;
}
.btn-link:hover {
    color: var(--primary-color);
}

/* Data Table */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius-md);
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}
.data-table th, .data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(28, 40, 19, 0.08);
}
.data-table th {
    background: rgba(28, 40, 19, 0.03);
    font-weight: 600;
    color: var(--secondary-green);
}
.data-table tbody tr:hover {
    background: rgba(28, 40, 19, 0.015);
}
.employee-avatar-name {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}
.table-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid var(--accent-light);
}

/* --- CREATE ID CARD PANEL --- */
.split-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: start;
}

.form-pane {
    padding: 32px;
}
.section-subtitle {
    font-size: 13px;
    color: var(--secondary-green);
    margin-bottom: 24px;
}

.form-row {
    display: flex;
    gap: 20px;
}
.col-6 {
    width: 50%;
}
.required {
    color: #e54b4b;
}

/* Photo Drag & Drop Upload Zone */
.photo-upload-zone {
    border: 2px dashed rgba(58, 138, 39, 0.3);
    border-radius: var(--border-radius-lg);
    background: rgba(58, 138, 39, 0.02);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.photo-upload-zone:hover, .photo-upload-zone.dragover {
    border-color: var(--accent-color);
    background: rgba(58, 138, 39, 0.05);
}
.cloud-icon {
    font-size: 36px;
    color: var(--accent-color);
    margin-bottom: 12px;
}
.zone-text {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}
.zone-hint {
    font-size: 11px;
    color: var(--secondary-green);
}
.link-like {
    text-decoration: underline;
}

/* Photo Preview & Controls */
.photo-preview-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 5;
    border: 1px solid rgba(28, 40, 19, 0.15);
}
.photo-preview-container img {
    height: 100%;
    width: 100%;
    object-fit: contain;
    transition: transform 0.1s ease;
}
.btn-clear-photo {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(229, 75, 75, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}
.btn-clear-photo:hover {
    background: #e54b4b;
}

.crop-controls {
    position: absolute;
    bottom: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}
.crop-controls .btn {
    padding: 6px 12px;
    font-size: 11px;
    border-radius: var(--border-radius-sm);
}

.form-actions {
    margin-top: 32px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    border-top: 1px solid rgba(28, 40, 19, 0.08);
    padding-top: 24px;
}

/* --- INTERACTIVE CARD PREVIEW SIDE --- */
.preview-pane {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.preview-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.preview-header h3 {
    font-size: 16px;
    font-weight: 700;
}

/* 3D Perspective Card Flipper Setup */
.id-card-perspective {
    perspective: 1200px;
    width: 350px;
    height: 554px; /* Standard scaled vertical ratio */
    margin-bottom: 30px;
}

.id-card-flipper {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 15px 35px rgba(28, 40, 19, 0.15);
    border-radius: 20px;
}
.id-card-flipper.flipped {
    transform: rotateY(180deg);
}

.id-card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
}

.id-card-back {
    transform: rotateY(180deg);
}

.card-inner-relative {
    position: relative;
    width: 100%;
    height: 100%;
}

.card-bg {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- OVERLAY TEXT/PHOTO PLACEMENT (Percentages derived from 638x1010 template) --- */

/* Front Photo Frame Box */
.front-photo-frame {
    position: absolute;
    left: 29.467%;     /* 188px / 638px */
    width: 40.909%;    /* 261px / 638px */
    top: 25.247%;      /* 255px / 1010px */
    height: 32.871%;   /* 332px / 1010px */
    z-index: 3;
    border-radius: 5.5%; /* Approximate border radius percentage */
    overflow: hidden;
}
.front-photo-wrapper {
    width: 100%;
    height: 100%;
    background: #fff;
    position: relative;
}
.front-photo-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: #e1e7de;
    background: #fcfdfc;
}

/* Erase block to cover pre-printed placeholder text on Front side */
.front-erase-block {
    position: absolute;
    left: 7.84%;       /* 50px / 638px */
    width: 84.32%;     /* 538px / 638px */
    top: 62.37%;       /* 630px / 1010px */
    height: 20.79%;    /* 210px / 1010px */
    background-color: var(--card-bg-mint);
    z-index: 2;
}

/* Front Text Placements */
.front-detail-name {
    position: absolute;
    left: 5%;
    width: 90%;
    top: 65.346%;      /* 660px / 1010px */
    text-align: center;
    font-size: 18px;   /* Scaled preview font-size */
    font-weight: 700;
    color: #000;
    z-index: 3;
    text-transform: capitalize;
}
.front-detail-designation {
    position: absolute;
    left: 5%;
    width: 90%;
    top: 70.792%;      /* 715px / 1010px */
    text-align: center;
    font-size: 13.5px; /* Scaled preview */
    font-weight: 400;
    color: #333;
    z-index: 3;
}
.front-detail-empid {
    position: absolute;
    left: 5%;
    width: 90%;
    top: 78.217%;      /* 790px / 1010px */
    text-align: center;
    font-size: 13px;   /* Scaled preview */
    font-weight: 700;
    color: #000;
    z-index: 3;
}

/* Back Card Details Positioning */
.back-field {
    position: absolute;
    left: 41.536%;     /* Colons alignment X=265px */
    width: 53%;        /* Max width to prevent overflow */
    font-size: 10.5px; /* Scaled down values */
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.back-colon {
    font-weight: 700;
    margin-right: 8px;
}
.back-val {
    color: #000;
}

/* Vertical coordinates for each field */
.back-field-name        { top: 8.217%; font-weight: 700; font-size: 11px; }  /* Y=83px */
.back-field-designation { top: 12.871%; } /* Y=130px */
.back-field-dob         { top: 17.227%; } /* Y=174px */
.back-field-doj         { top: 22.079%; } /* Y=223px */
.back-field-contact     { top: 26.435%; } /* Y=267px */
.back-field-address { 
    top: 31.089%; /* Y=314px */
    white-space: normal;
    display: inline-block;
    max-height: 40px;
    line-height: 1.2;
} 
.back-field-aadhar      { top: 35.643%; } /* Y=360px */
.back-field-blood       { top: 40.495%; } /* Y=409px */

.preview-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* --- EMPLOYEE DIRECTORY STYLES --- */
.directory-toolbar {
    padding: 20px 24px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.search-box {
    position: relative;
    flex-grow: 1;
    max-width: 500px;
}
.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary-green);
}
#dir-search-input {
    width: 100%;
    padding: 12px 16px 12px 46px;
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(28, 40, 19, 0.15);
    font-size: 14px;
    outline: none;
    transition: var(--transition-smooth);
}
#dir-search-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(58, 138, 39, 0.1);
}

.toolbar-actions {
    display: flex;
    gap: 12px;
}

.employee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.employee-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: var(--transition-smooth);
    border: 1.5px solid transparent;
}
.employee-card:hover {
    transform: translateY(-4px);
    border-color: rgba(58, 138, 39, 0.15);
    box-shadow: var(--shadow-hover);
}

.card-header-info {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--accent-light);
}
.card-meta-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.card-meta-text h4 {
    font-size: 16px;
    font-weight: 700;
}
.card-meta-text .code {
    font-size: 12px;
    color: var(--accent-color);
    font-weight: 700;
    margin-top: 2px;
}
.card-meta-text .desig {
    font-size: 13px;
    color: var(--secondary-green);
    margin-top: 2px;
}

.card-body-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    border-top: 1px dashed rgba(28, 40, 19, 0.1);
    padding-top: 16px;
    margin-bottom: 20px;
}
.detail-item {
    display: flex;
    justify-content: space-between;
}
.detail-label {
    color: var(--secondary-green);
}
.detail-value {
    font-weight: 600;
}

.card-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}
.card-actions .btn {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: var(--border-radius-sm);
    flex-grow: 1;
}
.btn-danger {
    background: rgba(229, 75, 75, 0.1);
    color: #e54b4b;
}
.btn-danger:hover {
    background: #e54b4b;
    color: #fff;
}

/* --- EXCEL IMPORT MODAL STYLES --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(18, 35, 12, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-window {
    width: 850px;
    max-width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: scale-up 0.3s ease forwards;
    background: #fff;
}

@keyframes scale-up {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(28, 40, 19, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}
.modal-close {
    background: transparent;
    border: none;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    color: var(--secondary-green);
}
.modal-close:hover {
    color: var(--dark-charcoal);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
}

.excel-drop-zone {
    border: 2px dashed rgba(58, 138, 39, 0.3);
    background: rgba(58, 138, 39, 0.02);
    border-radius: var(--border-radius-lg);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.excel-drop-zone:hover, .excel-drop-zone.dragover {
    border-color: var(--accent-color);
    background: rgba(58, 138, 39, 0.05);
}

.modal-section-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.badge {
    padding: 4px 8px;
    background: rgba(58, 138, 39, 0.1);
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--border-radius-sm);
}

.mapping-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
    background: rgba(28, 40, 19, 0.02);
    padding: 16px;
    border-radius: var(--border-radius-md);
    border: 1px solid rgba(28, 40, 19, 0.05);
}
.mapping-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mapping-field label {
    font-size: 11px;
    font-weight: 700;
    color: var(--secondary-green);
}
.mapping-field select {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(28, 40, 19, 0.15);
    background: #fff;
}

.import-table-container {
    max-height: 250px;
    border: 1px solid rgba(28, 40, 19, 0.15);
    border-radius: var(--border-radius-md);
}

.progress-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(28, 40, 19, 0.06);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    margin-bottom: 10px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-light), var(--accent-color));
    transition: width 0.2s ease;
}
.import-log-box {
    margin-top: 16px;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: monospace;
    font-size: 11px;
    padding: 12px;
    height: 150px;
    overflow-y: auto;
    border-radius: var(--border-radius-md);
}
.import-log-entry { margin-bottom: 4px; }
.import-log-success { color: #8ec155; }
.import-log-error { color: #ff6b76; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(28, 40, 19, 0.08);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Toast System */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}
.toast {
    min-width: 300px;
    padding: 16px 20px;
    background: #fff;
    border-radius: var(--border-radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border-left: 4px solid var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: slide-left 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}
@keyframes slide-left {
    from { transform: translateX(50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
.toast-success { border-left-color: var(--accent-color); }
.toast-error { border-left-color: #e54b4b; }
.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
}
.toast-close {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #999;
}

/* --- PRINT SYSTEM (@media print) --- */
.print-only-sheet {
    display: none;
}

@media print {
    /* Hide everything on the page except the print-only-sheet container */
    body * {
        visibility: hidden;
    }
    
    .print-only-sheet, .print-only-sheet * {
        visibility: visible;
    }
    
    .print-only-sheet {
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #fff;
    }
    
    /* Grid printing layout for standard ID cards */
    .print-card-wrapper {
        display: inline-block;
        width: 85.6mm;
        height: 53.98mm; /* Standard horizontal credit card size, wait! */
        /* BUT our cards are vertical: 638 width by 1010 height.
           Standard vertical ID card is 53.98mm wide by 85.6mm high!
        */
        width: 53.98mm;
        height: 85.6mm;
        margin: 5mm;
        border: 1px solid #ccc;
        box-shadow: none;
        border-radius: 4.8mm; /* Matches credit card radius */
        overflow: hidden;
        page-break-inside: avoid;
        position: relative;
        background: #fff;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .print-card-wrapper img.card-bg {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 1;
    }
    
    /* Keep percentages aligned for printing */
    .print-card-wrapper .front-photo-frame {
        z-index: 3;
    }
    .print-card-wrapper .front-photo-wrapper {
        background: #fff;
    }
    .print-card-wrapper .front-erase-block {
        z-index: 2;
        background-color: var(--card-bg-mint) !important;
    }
    .print-card-wrapper .front-detail-name,
    .print-card-wrapper .front-detail-designation,
    .print-card-wrapper .front-detail-empid {
        z-index: 3;
    }
    
    /* Ensure absolute coordinates display correctly at print scale */
    .print-card-wrapper .front-detail-name { font-size: 10pt; }
    .print-card-wrapper .front-detail-designation { font-size: 7.5pt; }
    .print-card-wrapper .front-detail-empid { font-size: 7pt; }
    .print-card-wrapper .back-field { font-size: 5.8pt; }
    .print-card-wrapper .back-field-name { font-size: 6.2pt; }
    .print-card-wrapper .back-field-address { line-height: 1.15; max-height: 22mm; }
    
    /* Page Break styling */
    .page-break {
        page-break-after: always;
        height: 0;
        border: none;
        margin: 0;
        padding: 0;
    }
}

/* ==========================================
   MOBILE & RESPONSIVE STYLES
   ========================================== */

.mobile-logout-btn {
    display: none;
}

@media (max-width: 1024px) {
    /* Stack split layout on tablet / mobile */
    .split-layout {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .preview-pane {
        position: relative;
        top: 0;
        margin-top: 20px;
        width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
    
    .preview-actions {
        max-width: 350px;
    }

    /* General spacing */
    .tab-panel {
        padding: 20px 15px;
    }
    
    .content-header {
        padding: 20px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .header-actions {
        display: flex;
        gap: 10px;
        width: 100%;
        margin-top: 5px;
    }
    
    .header-actions .btn {
        flex-grow: 1;
        font-size: 13px;
        padding: 10px 16px;
    }
    
    .mobile-logout-btn {
        display: inline-flex !important;
        padding: 10px 14px;
        width: auto !important;
    }
    
    /* Login Page */
    .login-card {
        width: 90%;
        max-width: 380px;
        padding: 30px 20px;
    }
    
    /* Responsive Dashboard Grid & Menu */
    #dashboard-view {
        flex-direction: column;
    }
    
    /* Sidebar transforms into Bottom Navigation Bar */
    .sidebar {
        width: 100vw;
        height: 65px;
        flex-direction: row;
        position: fixed;
        bottom: 0;
        left: 0;
        z-index: 100;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    
    .sidebar-brand {
        display: none; /* Hide brand name in bottom nav */
    }
    
    .sidebar-menu {
        flex-direction: row;
        justify-content: space-around;
        align-items: center;
        width: 100%;
        padding: 0 10px;
        gap: 0;
    }
    
    .menu-item {
        flex-direction: column;
        gap: 4px;
        padding: 8px 12px;
        font-size: 10px;
        color: rgba(255, 255, 255, 0.6);
        flex-grow: 1;
        justify-content: center;
        text-align: center;
    }
    
    .menu-item i {
        font-size: 18px;
    }
    
    .menu-item.active {
        border-left: none;
        border-bottom: 3px solid var(--accent-light);
        border-radius: 0;
        padding-left: 12px;
        color: #fff;
    }
    
    /* Move User Details / Logout from sidebar footer */
    .sidebar-footer {
        display: none; /* Hide sidebar footer */
    }
    
    /* Add extra bottom padding to main content to not overlap bottom navigation */
    .main-content {
        padding-bottom: 80px;
        height: calc(100vh - 65px);
    }
    
    /* Form Rows */
    .form-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .col-6 {
        width: 100%;
    }
    
    /* Directory Search / Toolbar */
    .directory-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 15px;
    }
    
    .toolbar-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .toolbar-actions .btn {
        width: 100%;
        font-size: 13px;
        padding: 10px 16px;
    }
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    /* Employee cards grid */
    .employee-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 16px;
    }
}

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

    /* Scale down the 3D card slightly for small mobile devices */
    .id-card-perspective {
        width: 290px;
        height: 459px;
    }
    
    .front-detail-name {
        font-size: 15px;
    }
    
    .front-detail-designation {
        font-size: 11px;
    }
    
    .front-detail-empid {
        font-size: 11px;
    }
    
    .back-field {
        font-size: 9px;
    }
    
    /* Modal resizing */
    .modal-window {
        width: 95%;
        max-height: 90vh;
    }
    
    .mapping-grid {
        grid-template-columns: 1fr;
    }
}
