/* ================= GLOBAL RESET ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #1e4a6d;
    --primary-dark: #0b2b3f;
    --primary-light: #2c7da0;
    --secondary: #2e7d32;
    --warning: #ed6c02;
    --danger: #d32f2f;
    --info: #0288d1;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
    --shadow-xl: 0 25px 50px rgba(0,0,0,0.15);
}

/* =====================================================
   BODY
===================================================== */
body:not(.login-body) {
    min-height: 100vh;
    background: var(--gray-100);
}

/* =====================================================
   DASHBOARD LAYOUT
===================================================== */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* =====================================================
   SIDEBAR
===================================================== */
.sidebar {
    width: 260px;
    background: var(--primary-dark);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    gap: 0.5rem;
}

.logo span {
    background: var(--primary-light);
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-size: 0.8rem;
}

.nav-menu {
    padding: 1.5rem 0;
}

.nav-item {
    padding: 0.85rem 1.5rem;
    display: block;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: 0.3s;
}

.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    border-left: 4px solid white;
    color: white;
}

/* =====================================================
   MAIN CONTENT
===================================================== */
.main {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    background: var(--gray-100);
}

.main-content {
    padding: 20px 30px;
}

/* =====================================================
   PAGE HEADER
===================================================== */
.page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    padding: 20px 30px;
    border-radius: 0 0 16px 16px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid var(--gray-200);
}

.page-header h1 {
    font-size: 26px;
    font-weight: 600;
    color: var(--primary);
    margin: 0;
}

.page-header .add-btn {
    background: var(--primary);
    color: white;
    padding: 10px 22px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: 0.3s;
}

.page-header .add-btn:hover {
    background: var(--primary-dark);
}

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

.card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: 0.3s;
    border: 1px solid var(--gray-200);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
}

.card-label {
    color: var(--gray-600);
}

/* =====================================================
   BUTTONS
===================================================== */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--secondary);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* =====================================================
   LOGIN PAGE
===================================================== */
.login-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1e4a6d, #2c7da0);
}

.login-card {
    background: white;
    width: 380px;
    padding: 40px 30px;
    border-radius: 18px;
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.login-logo {
    width: 110px;
    margin-bottom: 15px;
}

.login-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 5px;
}

.login-subtitle {
    font-size: 13px;
    color: #777;
    margin-bottom: 25px;
}

.login-card input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 14px;
}

.login-card input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30,74,109,0.1);
}

.login-card button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: none;
    background: var(--primary);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.login-card button:hover {
    background: var(--primary-dark);
}

/* =====================================================
   EMPLOYEES DIRECTORY
===================================================== */
.directory-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow-md);
}

.directory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.directory-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 10px 40px 10px 15px;
    border-radius: 30px;
    border: 1px solid var(--gray-300);
    width: 260px;
    font-size: 14px;
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary);
}

.search-box span {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-500);
}

.table-responsive {
    overflow-x: auto;
}

/* Employee Table */
.employee-table {
    width: 100%;
    border-collapse: collapse;
}

.employee-table th {
    text-align: left;
    padding: 15px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 2px solid var(--gray-200);
    background: var(--gray-50);
}

.employee-table td {
    padding: 15px 12px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
    vertical-align: middle;
}

.employee-table tr:hover {
    background: var(--gray-50);
}

/* Employee Cell */
.employee-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.employee-avatar-wrapper {
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
}

.employee-avatar-wrapper:hover {
    opacity: 0.8;
}

.employee-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.employee-avatar-image {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
}

.emp-details {
    line-height: 1.4;
    min-width: 180px;
}

.emp-name {
    font-weight: 600;
    color: var(--gray-800);
}

.emp-cnic {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 2px;
}

.emp-email {
    color: var(--gray-800);
}

.emp-phone {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 2px;
}

.emp-salary {
    font-weight: 600;
    color: var(--primary);
}

/* Status Badge */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
}

.status-badge.active {
    background: #e8f5e9;
    color: var(--secondary);
}

.status-badge.inactive {
    background: #ffebee;
    color: var(--danger);
}

/* Action Icons */
.action-icons {
    display: flex;
    gap: 8px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: var(--gray-100);
    color: var(--gray-700);
    font-size: 16px;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.action-btn:hover {
    background: var(--gray-200);
}

.action-btn.view:hover {
    background: #e3f2fd;
    color: var(--info);
}

.action-btn.edit:hover {
    background: #fff3e0;
    color: var(--warning);
}

.action-btn.delete:hover {
    background: #ffebee;
    color: var(--danger);
}

/* =====================================================
   MODAL STYLES
===================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    box-shadow: var(--shadow-xl);
    z-index: 10000;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gray-200);
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--gray-800);
}

.close {
    font-size: 2rem;
    cursor: pointer;
    color: var(--gray-500);
    transition: 0.3s;
    line-height: 1;
}

.close:hover {
    color: var(--danger);
}

/* Profile Container */
.profile-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Profile Header */
.profile-header-section {
    display: flex;
    gap: 2rem;
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    padding: 2rem;
    border-radius: 16px;
    color: white;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.profile-avatar-initials {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--primary);
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 10px;
    padding: 4px;
    text-align: center;
    opacity: 0;
    transition: 0.3s;
}

.profile-avatar-large:hover .upload-hint {
    opacity: 1;
}

.profile-header-info {
    flex: 1;
}

.profile-name-large {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.profile-title-large {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0.75rem;
}

.profile-badges {
    display: flex;
    gap: 0.5rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--gray-200);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    color: var(--gray-600);
    font-weight: 500;
    transition: 0.3s;
    font-size: 14px;
}

.tab:hover {
    background: var(--gray-100);
}

.tab.active {
    background: var(--primary);
    color: white;
}

/* Profile Tabs Content */
.profile-tab {
    display: none;
}

.profile-tab.active {
    display: block !important;
}

/* Section Cards */
.section-card {
    background: var(--gray-50);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Details Grid */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.detail-item {
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}

.detail-label {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1rem;
    font-weight: 500;
    color: var(--gray-800);
}

/* History Tables */
.history-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 1.5rem 0 0.75rem 0;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.history-table th {
    background: var(--gray-100);
    padding: 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
}

.history-table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 13px;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.no-data {
    color: var(--gray-500);
    font-style: italic;
    padding: 12px;
    background: var(--gray-50);
    border-radius: 6px;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: #e8f5e9;
    color: var(--secondary);
}

.badge-info {
    background: #e3f2fd;
    color: var(--info);
}

.badge-warning {
    background: #fff3e0;
    color: var(--warning);
}

.badge-danger {
    background: #ffebee;
    color: var(--danger);
}

.badge-primary {
    background: #e1f5fe;
    color: var(--primary);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--gray-800);
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
    z-index: 3000;
    max-width: 350px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast-success {
    background: var(--secondary);
}

.toast-error {
    background: var(--danger);
}

.toast-warning {
    background: var(--warning);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

/* Confirmation Dialog */
.confirm-dialog {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.confirm-icon {
    font-size: 3rem;
    color: var(--warning);
    margin-bottom: 1rem;
}

.confirm-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.confirm-message {
    color: var(--gray-600);
    margin-bottom: 2rem;
}

.confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}


/* =====================================================
   EMPLOYEE FORM STYLES (EDIT/ADD)
===================================================== */
.employee-form {
    width: 100%;
}

.employee-form h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 30px 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-200);
}

.employee-form h3:first-of-type {
    margin-top: 0;
}

.employee-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--gray-700);
}

.employee-form input,
.employee-form select,
.employee-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.employee-form input:focus,
.employee-form select:focus,
.employee-form textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(30,74,109,0.1);
}

.employee-form input[readonly] {
    background: var(--gray-100);
    cursor: not-allowed;
}

.employee-form textarea {
    min-height: 80px;
    resize: vertical;
}

/* Form Grid Layout */
.employee-form .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Form Buttons */
.employee-form .form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.employee-form .btn-cancel {
    padding: 12px 25px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
}

.employee-form .btn-cancel:hover {
    background: #5a6268;
}

.employee-form .btn-submit {
    padding: 12px 25px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.employee-form .btn-submit:hover {
    background: var(--primary-dark);
}

/* Required field indicator */
.employee-form label:after {
    content: " *";
    color: var(--danger);
    display: none;
}

.employee-form label[for*="required"]:after,
.employee-form .required:after {
    display: inline;
}


.form-control {
    width:100%;
    padding:10px;
    border:1px solid #ddd;
    border-radius:8px;
}


/* =====================================================
   RESPONSIVE
===================================================== */
@media (max-width: 1024px) {
    .details-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .main {
        margin-left: 0;
        width: 100%;
    }

    .main-content {
        padding: 15px;
    }

    .page-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .directory-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .search-box input {
        width: 100%;
    }

    .profile-header-section {
        flex-direction: column;
        text-align: center;
    }

    .tabs {
        justify-content: center;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-header {
        padding: 15px 20px;
    }

    .modal-content {
        padding: 1.5rem;
    }
    
    .action-icons {
        flex-wrap: wrap;
    }
}