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

:root {
    --primary-color: #6D28D9; /* Purple */
    --primary-gradient: linear-gradient(135deg, #4C1D95 0%, #6D28D9 100%); /* Deep Purple to Light Purple */
    --accent-color: #a78bfa; /* Light Accent Purple */
    --dark-color: #1e1b4b; /* Deep Indigo / Dark Purple */
    --light-bg: #F5F7FB; /* Modern light grayish blue background */
    --white: #ffffff;
    --gray-muted: #64748b; /* Slate Gray */
    --border-color: #e2e8f0; /* Soft Slate Border */
    --sidebar-width: 220px; /* Redesigned fixed sidebar width */
    --header-height: 70px;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--light-bg);
    color: var(--dark-color);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Hide native password reveal icons */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear,
input[type="password"]::-webkit-contacts-auto-fill-button,
input[type="password"]::-webkit-credentials-auto-fill-button {
    display: none !important;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--light-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--gray-muted);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--dark-color);
}

/* Header styling */
.main-header {
    height: var(--header-height);
    background: var(--primary-gradient);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.header-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-search {
    max-width: 400px;
    width: 100%;
}

.header-search .form-control {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: var(--white);
    border-radius: 30px;
    padding-left: 1.25rem;
}

.header-search .form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.header-search .form-control:focus {
    background: rgba(255, 255, 255, 0.25);
    box-shadow: none;
    outline: none;
}

/* Sidebar Styling */
.main-sidebar {
    width: var(--sidebar-width);
    height: calc(100vh - var(--header-height));
    background: var(--white);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: var(--header-height);
    left: 0;
    z-index: 1020;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.sidebar-menu {
    padding: 1.5rem 0;
    list-style: none;
    margin: 0;
}

.menu-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    color: var(--gray-muted);
    padding: 0.75rem 1.5rem 0.25rem;
    font-weight: 700;
}

.menu-item {
    margin-bottom: 0.25rem;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--dark-color);
    text-decoration: none;
    font-weight: 500;
    border-left: 4px solid transparent;
    transition: all 0.2s ease;
}

.menu-link:hover, .menu-link.active {
    background-color: rgba(109, 40, 217, 0.05);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.menu-link i {
    font-size: 1.1rem;
    color: var(--gray-muted);
    transition: color 0.2s ease;
}

.menu-link:hover i, .menu-link.active i {
    color: var(--primary-color);
}

/* Accordion for Sidebar Submenu */
.submenu-list {
    list-style: none;
    padding-left: 2.75rem;
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
}

.submenu-link {
    display: block;
    padding: 0.5rem 0;
    color: var(--gray-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.submenu-link:hover, .submenu-link.active {
    color: var(--primary-color);
}

/* Main Content Wrapper */
.content-wrapper {
    margin-left: var(--sidebar-width);
    padding-top: var(--header-height);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    background: var(--light-bg);
    overflow-x: hidden;
    width: calc(100% - var(--sidebar-width)) !important;
    max-width: none !important;
    margin-right: 0 !important;
    flex: 1 1 auto;
}

.content-inner {
    padding: 1.5rem 1.75rem;
    box-sizing: border-box;
    max-width: none !important;
    width: 100% !important;
}

/* Page Header Bar — consistent across all pages */
.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0 1.25rem;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 1.5rem;
}
.page-header-bar h3 {
    margin-bottom: 0;
    font-size: 1.4rem;
}

/* Full-width flat panel — replaces card boxing around tables */
.panel-full {
    background: var(--white);
    border-radius: 0;
    border: none;
    border-top: 2px solid var(--border-color);
    width: 100%;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
}

.panel-full .panel-body {
    padding: 1.25rem 1.5rem;
}

/* Page wrapper fills viewport */
body > .d-flex {
    flex: 1 1 auto;
    width: 100%;
    min-height: 100vh;
    align-items: stretch;
}

/* Responsive Sidebar Toggle */
@media (max-width: 991.98px) {
    .main-sidebar {
        left: -260px;
    }
    .content-wrapper {
        margin-left: 0;
    }
    .main-sidebar.show {
        left: 0;
    }
}

/* Premium Dashboard Metric Cards */
.metric-card {
    background: var(--white);
    border-radius: 20px !important;
    border: none !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04) !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.08) !important;
}

.metric-card-inner {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-info h6 {
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--gray-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.metric-info h2 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
}

.metric-icon-box {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.bg-primary-light {
    background-color: rgba(109, 40, 217, 0.1);
    color: var(--primary-color);
}
.bg-success-light {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}
.bg-warning-light {
    background-color: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}
.bg-danger-light {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}
.bg-purple-light {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--accent-color);
}

/* Tables and Cards */
.card-premium {
    background: var(--white);
    border-radius: 0 !important;
    border: none !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04) !important;
    margin-bottom: 0;
    width: 100%;
}

/* When card-premium is used as standalone (not table wrapper), keep normal radius */
.card-premium.card-standalone {
    border-radius: 16px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05) !important;
    margin-bottom: 1.5rem;
}

.card-premium .card-header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-premium .card-body {
    padding: 1.25rem 1.5rem;
}

/* Custom Table design */
.table-premium th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--gray-muted);
    border-bottom: 2px solid var(--border-color);
}

.table-premium td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
}

.avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
}

/* Badge styling */
.badge-premium {
    padding: 0.4em 0.8em;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.8rem;
}

/* Landing Page Design */
.hero-section {
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.94) 0%, rgba(124, 58, 237, 0.94) 100%), url('https://images.unsplash.com/photo-1521737711867-e3b904737d88?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    color: var(--white);
    padding: 10rem 0 8rem;
    min-height: 80vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Modern Interactive Blur Blobs */
.hero-blob {
    position: absolute;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    background: rgba(167, 139, 250, 0.22);
    filter: blur(90px);
    z-index: 1;
    pointer-events: none;
    animation: float-blob 12s infinite alternate ease-in-out;
}
.hero-blob-1 {
    top: -10%;
    right: 5%;
}
.hero-blob-2 {
    bottom: -15%;
    left: 5%;
    background: rgba(124, 58, 237, 0.22);
    animation-delay: -6s;
}
@keyframes float-blob {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, -40px) scale(1.15); }
}

.hero-content {
    position: relative;
    z-index: 2;
}

.feature-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 10px 30px rgba(109, 40, 217, 0.03);
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(109, 40, 217, 0.12);
}

.feature-card:hover::before {
    transform: scaleX(1);
}

.feature-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    transition: transform 0.4s ease;
}

.feature-card:hover .feature-icon {
    transform: scale(1.15) rotate(8deg);
}

/* Premium Interaction buttons on landing */
.btn-hover-lift {
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
}
.btn-hover-lift:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 20px rgba(109, 40, 217, 0.35) !important;
}

.btn-purple-dark {
    background-color: var(--dark-color) !important;
    color: var(--white) !important;
    border: 1px solid rgba(109, 40, 217, 0.2) !important;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
}
.btn-purple-dark:hover {
    background: var(--primary-gradient) !important;
    border-color: transparent !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 20px rgba(109, 40, 217, 0.35) !important;
}

/* Interactive slide animations */
.animate-fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-header.admin-header {
    background: linear-gradient(135deg, #4C1D95 0%, #6D28D9 100%) !important;
}

.main-header.employee-header {
    background: linear-gradient(135deg, #4C1D95 0%, #6D28D9 100%) !important;
}

/* Sidebar Active/Hover Accents */
.admin-sidebar .menu-link:hover, 
.admin-sidebar .menu-link.active {
    background-color: rgba(13, 148, 136, 0.06) !important;
    color: var(--primary-color) !important;
    border-left-color: var(--primary-color) !important;
}

.admin-sidebar .menu-link:hover i, 
.admin-sidebar .menu-link.active i {
    color: var(--primary-color) !important;
}

.employee-sidebar .menu-link:hover, 
.employee-sidebar .menu-link.active {
    background-color: rgba(13, 148, 136, 0.06) !important;
    color: var(--primary-color) !important;
    border-left-color: var(--primary-color) !important;
}

.employee-sidebar .menu-link:hover i, 
.employee-sidebar .menu-link.active i {
    color: var(--primary-color) !important;
}

/* Override Bootstrap primary elements with purple theme */
.btn-primary {
    background: var(--primary-gradient) !important;
    border: none !important;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: linear-gradient(135deg, #5b21b6 0%, #3b37c3 100%) !important;
    box-shadow: 0 0 0 0.25rem rgba(109, 40, 217, 0.25) !important;
}
.btn-outline-primary {
    color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}
.btn-outline-primary:hover {
    background: var(--primary-gradient) !important;
    color: var(--white) !important;
    border-color: transparent !important;
}
.text-primary {
    color: var(--primary-color) !important;
}
.bg-primary {
    background: var(--primary-gradient) !important;
}
.border-primary {
    border-color: var(--primary-color) !important;
}

/* Print-Friendly Styles */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    
    /* Hide headers, sidebars, footers, backdrop overlays, and buttons globally in print */
    .main-header,
    .main-sidebar,
    .modal-backdrop,
    footer,
    .btn,
    button {
        display: none !important;
    }
    
    /* Adjust content wrapper layout for print */
    .content-wrapper {
        margin-left: 0 !important;
        padding-top: 0 !important;
        background: transparent !important;
    }

    /* Print styling specifically when a modal is open (like payslip) */
    body.modal-open .content-wrapper {
        display: none !important;
    }
    
    body.modal-open .modal {
        position: relative !important;
        display: block !important;
        opacity: 1 !important;
        z-index: 9999 !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: none !important;
    }
    
    body.modal-open .modal-dialog {
        margin: 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        position: relative !important;
    }
    
    body.modal-open .modal-content {
        border: none !important;
        box-shadow: none !important;
        background: #ffffff !important;
    }
    
    body.modal-open .modal-header,
    body.modal-open .modal-footer {
        display: none !important;
    }
    
    #printablePayslip {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
}

/* Premium Centered Table Action Buttons */
.table-premium td .btn.rounded-circle {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s ease;
    vertical-align: middle;
}
.table-premium td .btn.rounded-circle i {
    font-size: 0.85rem;
    margin: 0;
}

/* Editable Profile Photo Overlay styles */
.profile-avatar-container:hover .avatar-edit-overlay {
    opacity: 1 !important;
}
.profile-avatar-container:hover img,
.profile-avatar-container:hover div {
    filter: brightness(0.8);
    transition: filter 0.2s ease;
}

/* System Footer spacing to respect sidebar width */
.main-system-footer {
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
}

@media (max-width: 991.98px) {
    .main-system-footer {
        margin-left: 0;
    }
}

/* Sidebar Collapse on Desktop (Full View Style) */
@media (min-width: 992px) {
    body.sidebar-collapsed .main-sidebar {
        transform: translateX(-260px);
    }
    body.sidebar-collapsed .content-wrapper {
        margin-left: 0;
    }
    body.sidebar-collapsed .main-system-footer {
        margin-left: 0;
    }
}

/* Page wrapper — only needs to exist as a container */
body > div.d-flex {
    min-height: 100vh;
}

/* ═══════════════════════════════════════════
   FULL-WIDTH TABLE LAYOUT — Global Override
   Applies to all pages uniformly
═══════════════════════════════════════════ */

/* Make table containers full-bleed (no card boxing) */
.content-inner .card-premium {
    border-radius: 12px !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06) !important;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

/* Table header styling — clean sticky-style */
.table-premium thead tr {
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
}

.table-premium th {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.07em;
    color: var(--gray-muted);
    padding: 0.9rem 1rem;
    background: #f8fafc;
    white-space: nowrap;
}

/* Table rows */
.table-premium td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.table-premium tbody tr:hover {
    background: rgba(124, 58, 237, 0.03);
}

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

/* ── DataTables Controls Overrides ── */

/* Search input */
div.dataTables_wrapper div.dataTables_filter input {
    border: 1.5px solid var(--border-color) !important;
    border-radius: 30px !important;
    padding: 0.45rem 1.1rem !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.875rem !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 220px;
}

div.dataTables_wrapper div.dataTables_filter input:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12) !important;
    outline: none !important;
}

/* Length select layout fix to prevent line breaks */
div.dataTables_wrapper div.dataTables_length label {
    display: inline-flex !important;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    white-space: nowrap;
}

div.dataTables_wrapper div.dataTables_length select {
    border: 1.5px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 0.35rem 2rem 0.35rem 0.6rem !important; /* Right padding for dropdown arrow */
    font-family: 'Outfit', sans-serif !important;
    font-size: 0.875rem !important;
    width: auto !important;
    display: inline-block !important;
}

/* Info text */
div.dataTables_wrapper div.dataTables_info {
    font-size: 0.82rem;
    color: var(--gray-muted);
    padding-top: 0.85em;
}

/* Pagination buttons */
div.dataTables_wrapper div.dataTables_paginate {
    padding-top: 0.6rem;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button {
    border-radius: 8px !important;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.82rem !important;
    font-family: 'Outfit', sans-serif !important;
    margin: 0 2px !important;
    border: 1.5px solid transparent !important;
    transition: all 0.18s ease !important;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button:hover {
    background: rgba(124, 58, 237, 0.08) !important;
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button.current,
div.dataTables_wrapper div.dataTables_paginate .paginate_button.current:hover {
    background: var(--primary-gradient) !important;
    border-color: transparent !important;
    color: #fff !important;
    font-weight: 600 !important;
}

div.dataTables_wrapper div.dataTables_paginate .paginate_button.disabled,
div.dataTables_wrapper div.dataTables_paginate .paginate_button.disabled:hover {
    opacity: 0.4 !important;
    cursor: default !important;
}

/* DataTables top/bottom bars padding */
div.dataTables_wrapper div.dataTables_filter,
div.dataTables_wrapper div.dataTables_length {
    padding: 0.5rem 0;
}

/* Make responsive table wrapper take full width */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

/* Metric card — keep rounded for dashboard */
.metric-card {
    border-radius: 20px !important;
}

/* Alert and form cards — keep rounded */
.card:not(.card-premium) {
    border-radius: 20px !important;
}

/* Responsive 4-column Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767.98px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Analytics side-by-side section */
.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1200px) {
    .analytics-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Dashboard Premium Card */
.dashboard-card {
    background: var(--white);
    border-radius: 20px !important;
    border: none !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04) !important;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.dashboard-card .card-header {
    background: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.dashboard-card .card-body {
    padding: 1.5rem;
}
