/* --- GLOBAL VARIABLES --- */
:root {
    --primary: #0f172a;
    --accent: #2563eb;
    --bg-main: #f8fafc;
    --text-dark: #334155;
    --text-light: #64748b;
    --border: #e2e8f0;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-main);
    margin: 0;
    color: var(--text-dark);
}

.hidden {
    display: none !important;
}

/* --- NAVBAR --- */
.navbar {
    background: white;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--primary);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
}

.user-badge:hover {
    background: #e2e8f0;
}

.container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* --- CARDS --- */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: 0.2s;
    cursor: pointer;
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

/* --- FORMS & TABLES --- */
.form-box {
    background: white;
    padding: 25px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.form-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 2px solid #fbbf24;
    padding-bottom: 10px;
}

.input-group {
    margin-bottom: 15px;
}

.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-light);
}

input,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
}

.sub-table {
    width: 100%;
    margin-top: 10px;
    border: 1px solid var(--border);
    border-collapse: collapse;
}

.sub-table th {
    background: #fbbf24;
    padding: 8px;
    font-size: 0.8rem;
    text-align: left;
}

.sub-table td {
    padding: 5px;
    border-bottom: 1px solid var(--border);
}

/* --- REPORTS LIST --- */
.report-list {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.report-list th {
    background: #f1f5f9;
    text-align: left;
    padding: 12px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.report-list td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.report-list tr:hover {
    background: #f8fafc;
    cursor: pointer;
}

/* --- BUTTONS --- */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: white;
    width: 100%;
}

.btn-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-dark);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-add {
    background: #ecfdf5;
    color: #059669;
    width: 100%;
    margin-top: 5px;
}

.btn-remove {
    color: #ef4444;
    background: #fef2f2;
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

/* --- PRINT --- */
@media print {
    body * {
        visibility: hidden;
    }

    #viewDPR,
    #viewDPR * {
        visibility: visible;
    }

    #viewDPR {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        border: none;
    }

    .no-print,
    .navbar {
        display: none !important;
    }

    input,
    select {
        border: none !important;
        background: transparent !important;
        padding: 0;
        font-weight: bold;
    }
}


/* --- STATUS & BUFFER STYLES --- */
.status-box {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    display: none;
    /* Default hidden */
    text-align: center;
}

.status-loading {
    background: #e0f2fe;
    color: #0284c7;
    border: 1px solid #bae6fd;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.status-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Success Actions (Print/Clear buttons inside message) */
.success-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Spinner Animation */
.loader-spin {
    width: 18px;
    height: 18px;
    border: 3px solid #0284c7;
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}



/* --- ATTENDANCE STYLES --- */
.att-btn-group {
    display: flex;
    gap: 5px;
}

.btn-att {
    flex: 1;
    padding: 8px 0;
    border: 1px solid #e2e8f0;
    background: white;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    color: #64748b;
    transition: 0.1s;
}

/* Colors when ACTIVE (Selected) */
.p-btn.active {
    background: #22c55e;
    color: white;
    border-color: #16a34a;
}

/* Green */
.h-btn.active {
    background: #f59e0b;
    color: white;
    border-color: #d97706;
}

/* Orange */
.a-btn.active {
    background: #ef4444;
    color: white;
    border-color: #dc2626;
}

/* Red */

/* Loading text */
#attLoader {
    text-align: center;
    padding: 20px;
    color: #2563eb;
    display: none;
}

/* --- MONTHLY REPORT TABLE --- */
.report-list th,
.report-list td {
    white-space: nowrap;
    /* Text wrap nahi hoga */
    padding: 8px 5px;
    /* Thoda compact */
    font-size: 0.85rem;
}

/* Print Friendly Logic for Monthly Table */
@media print {
    body {
        font-size: 10pt;
    }

    .form-box {
        border: none;
        overflow: visible !important;
    }

    #monthlyTable {
        min-width: 100%;
        width: 100%;
    }

    th,
    td {
        border: 1px solid #000 !important;
    }
}

/* --- EMPLOYEE PORTAL DESIGN (From your code) --- */
.emp-container {
    max-width: 850px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
}

.section-box {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-weight: 700;
    color: #34495e;
    margin-bottom: 12px;
    display: block;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 5px;
}

.search-box {
    background: #e3f2fd;
    border: 1px solid #bbdefb;
}

.search-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 10px;
}

.grid-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 10px;
}

.grid-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.emp-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.85em;
    color: #555;
}

.emp-container input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    background: #fafafa;
}

.emp-container input:focus {
    border-color: #3498db;
    background: #fff;
    outline: none;
}

.btn-search {
    background: #34495e;
    color: white;
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
}

.btn-submit {
    background: #2980b9;
    color: white;
    width: 100%;
    margin-top: 10px;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(41, 128, 185, 0.2);
}

.btn-reset {
    background: #e74c3c;
    color: white;
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

@media (max-width: 600px) {

    .grid-row,
    .grid-row-3 {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* --- BUBBLE TAB NAVIGATION --- */
.bubble-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    background: #f1f5f9;
    padding: 10px;
    border-radius: 50px; /* Full Rounded */
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.bubble-btn {
    padding: 10px 25px;
    border: none;
    background: transparent;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bouncy Effect */
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.bubble-btn:hover {
    color: #334155;
    background: rgba(255,255,255,0.5);
}

.bubble-btn.active {
    background: #2563eb; /* Blue Bubble */
    color: white;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    transform: scale(1.05);
}

/* --- SECTION ANIMATION (Pop In) --- */
.tab-section {
    display: none; /* Hidden by default */
    animation: popIn 0.4s ease-out forwards;
}

.tab-section.active {
    display: block;
}

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.95) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Form Container Tweaks */
.emp-container { padding: 5px; }

/* --- SETTINGS / PROFILE PAGE --- */
.profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}

.profile-pic-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    cursor: pointer;
}

.profile-pic {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #2563eb;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.camera-icon {
    position: absolute;
    bottom: 0;
    right: 0;
    background: #2563eb;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    border: 2px solid white;
}

.logout-btn-box {
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.btn-danger {
    background: #fee2e2;
    color: #ef4444;
    border: 1px solid #fecaca;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}


/* --- DLR MODULE STYLES --- */
.dlr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.dlr-table th {
    background: #e2e8f0;
    padding: 8px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #cbd5e1;
}

.dlr-table td {
    border: 1px solid #e2e8f0;
    padding: 5px;
}

/* Compact Inputs for Table */
.dlr-input {
    width: 100%;
    padding: 5px;
    border: 1px solid transparent; /* Invisible border until focus */
    background: transparent;
    font-size: 0.9rem;
    outline: none;
}

.dlr-input:focus {
    border-bottom: 2px solid #2563eb;
    background: #fff;
}

.dlr-select {
    width: 100%;
    padding: 5px;
    border: none;
    background: transparent;
}

.btn-del-row {
    color: red;
    background: none;
    border: none;
    font-weight: bold;
    cursor: pointer;
    font-size: 1.2rem;
}


/* --- DLR MOBILE RESPONSIVE (CARD STYLE) --- */

/* Desktop Default (Table Style) */
.dlr-table {
    width: 100%;
    border-collapse: collapse;
}
.dlr-table th, .dlr-table td {
    border: 1px solid #e2e8f0;
    padding: 8px;
    vertical-align: middle;
}

/* MOBILE VIEW (Max Width 768px) */
@media screen and (max-width: 768px) {
    
    /* 1. Header Chupao (Mobile me labels ki jarurat nahi) */
    .dlr-table thead {
        display: none;
    }

    /* 2. Row ko Card banao */
    .dlr-table tbody tr {
        display: block;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        margin-bottom: 15px;
        padding: 15px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
        position: relative; /* Delete button positioning ke liye */
    }

    /* 3. Cells ko Block banao */
    .dlr-table td {
        display: block;
        border: none;
        padding: 5px 0;
    }

    /* 4. Inputs ko bada aur sunder banao */
    .dlr-input, .dlr-select {
        width: 100%;
        padding: 12px;
        background: #f8fafc;
        border: 1px solid #cbd5e1;
        border-radius: 8px;
        font-size: 1rem; /* Bada text */
        margin-bottom: 5px;
    }
    
    .dlr-input:focus, .dlr-select:focus {
        border-color: #2563eb;
        background: #fff;
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    /* 5. Specific Layout Tweaks */
    
    /* Name & Designation full width */
    .dlr-table td:nth-child(2), /* Name */
    .dlr-table td:nth-child(3) { /* Designation */
        width: 100%;
    }

    /* Time In & Out (Side by Side) */
    .time-wrapper {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Serial No (#) ko chupao ya design karo */
    .dlr-table td:first-child {
        font-weight: bold;
        color: #2563eb;
        margin-bottom: 5px;
        border-bottom: 1px dashed #eee;
        padding-bottom: 5px;
    }
    .dlr-table td:first-child::before {
        content: "Worker #";
    }

    /* Delete Button (Floating Top Right) */
    .dlr-table td:last-child {
        position: absolute;
        top: 10px;
        right: 10px;
        width: auto;
    }
    
    .btn-del-row {
        background: #fee2e2;
        color: #ef4444;
        width: 35px;
        height: 35px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
    }
}

/* =========================================
   🚀 APP REFINING & POLISH (PREMIUM LOOK)
========================================= */

/* 1. SMOOTH ANIMATIONS (Page Fade In) */
.hidden {
    display: none !important;
    opacity: 0;
}

/* Jab koi page dikhe, to wo dheere se aaye */
div:not(.hidden) {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* 2. MODERN CARDS (Dashboard) */
.card {
    background: white;
    border: none; /* Border hataya */
    border-radius: 16px; /* Zyada gol */
    box-shadow: 0 4px 20px rgba(0,0,0,0.05); /* Soft Shadow */
    transition: all 0.2s ease;
    border-left: 5px solid transparent; /* Side me color strip ke liye */
}

.card:active {
    transform: scale(0.96); /* Click karne par chhota hoga */
    background: #f8fafc;
}

/* Har card ko alag rang ki strip */
.card:nth-child(1) { border-left-color: #2563eb; } /* Blue */
.card:nth-child(2) { border-left-color: #f59e0b; } /* Orange */
.card:nth-child(3) { border-left-color: #16a34a; } /* Green */
.card:nth-child(4) { border-left-color: #db2777; } /* Pink */
.card:nth-child(5) { border-left-color: #8b5cf6; } /* Purple */

/* 3. INPUT FIELDS (Clean Look) */
input, select, textarea {
    border: 1px solid #e2e8f0;
    border-radius: 10px !important;
    padding: 12px 15px !important;
    font-size: 1rem;
    background: #f8fafc;
    transition: 0.3s;
}

input:focus, select:focus {
    background: #fff;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1); /* Glow Effect */
    outline: none;
}

/* 4. BUTTONS (Apple Style) */
.btn, .btn-submit, .bubble-btn {
    border-radius: 50px !important; /* Pill Shape */
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.1s;
}

.btn:active, .btn-submit:active {
    transform: scale(0.95);
    box-shadow: none;
}

/* 5. HEADER GRADIENT */
header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

/* 6. MOBILE IMPROVEMENTS */
@media screen and (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    /* Inputs thode bade mobile ke liye */
    input, select {
        padding: 14px !important; 
    }
}

/* SPINNER LOADER */
.loader {
    width: 16px;
    height: 16px;
    border: 2px solid #fff;
    border-bottom-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
    margin-right: 8px;
}

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