/* 
 * Payroll - SaaS Premium Theme Stylesheet
 * Integrates beautifully with Bootstrap 5.3 Color Modes
 */

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

/* Color Variables & Theme Configurations */
:root, [data-theme="light"] {
    --primary: #0052CC;
    --primary-hover: #0065FF;
    --primary-light: #DEEBFF;
    --primary-shadow: rgba(0, 82, 204, 0.35);
    --primary-shadow-hover: rgba(0, 82, 204, 0.55);
    --secondary: #42526E;
    --success: #36B37E;
    --success-light: #E3FCEF;
    --danger: #FF5630;
    --danger-light: #FFEBE6;
    --warning: #FFAB00;
    --warning-light: #FFFAE6;
    --info: #6554C0;
    --info-light: #EAE6FF;

    --bg-body: #FAFBFC;
    --bg-surface: #FFFFFF;
    --bg-surface-header: rgba(255, 255, 255, 0.95);
    --text-main: #172B4D;
    --text-heading: #172B4D;
    --text-muted: #5E6C84;
    --border-color: #DFE1E6;
    --shadow-color: rgba(9, 30, 66, 0.08);

    --sidebar-bg: #0747A6;
    --sidebar-text: #DEEBFF;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
    --sidebar-active-bg: #0052CC;
    --sidebar-active-text: #FFFFFF;
    --sidebar-border: rgba(255, 255, 255, 0.1);

    --header-bg: #FFFFFF;
    --header-border: #DFE1E6;
    --header-text: #172B4D;

    --card-shadow: 0 1px 1px rgba(9, 30, 66, 0.25), 0 0 1px rgba(9, 30, 66, 0.31);
}

[data-theme="dark"] {
    --primary: #388BFF;
    --primary-hover: #66B3FF;
    --primary-light: rgba(56, 139, 255, 0.15);
    --primary-shadow: rgba(56, 139, 255, 0.25);
    --primary-shadow-hover: rgba(56, 139, 255, 0.45);
    --secondary: #8993A4;
    --success: #36B37E;
    --success-light: rgba(54, 179, 126, 0.15);
    --danger: #FF5630;
    --danger-light: rgba(255, 86, 48, 0.15);
    --warning: #FFAB00;
    --warning-light: rgba(255, 171, 0, 0.15);
    --info: #85B8FF;
    --info-light: rgba(133, 184, 255, 0.15);

    --bg-body: #090E17;
    --bg-surface: #161A23;
    --bg-surface-header: #1E2330;
    --text-main: #C1C7D0;
    --text-heading: #FFFFFF;
    --text-muted: #8993A4;
    --border-color: #2C3545;
    --shadow-color: rgba(0, 0, 0, 0.5);

    --sidebar-bg: #0B0E14;
    --sidebar-text: #A5ADBA;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.05);
    --sidebar-active-bg: #1D2125;
    --sidebar-active-text: #FFFFFF;
    --sidebar-border: #22272B;

    --header-bg: #161A23;
    --header-border: #2C3545;
    --header-text: #FFFFFF;

    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Base resets & transitions */
body {
    background-color: var(--bg-body) !important;
    color: var(--text-main) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-heading) !important;
    font-weight: 600;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: all 0.2s ease;
}
a:hover {
    color: var(--primary-hover);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Premium Layout Components */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Dynamic & Glowing Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 101;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--sidebar-border);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #FFFFFF !important;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    letter-spacing: -0.5px;
}
.sidebar-logo span {
    background: linear-gradient(135deg, #FFDD55 0%, #FF5566 50%, #8855FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 0.75rem;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0 0.75rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #DEEBFF !important;
    opacity: 0.75 !important;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text) !important;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 12px;
    margin-bottom: 0.25rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover {
    color: #FFFFFF !important;
    background-color: var(--sidebar-hover-bg);
    transform: translateX(4px);
}

.nav-item.active {
    color: var(--sidebar-active-text) !important;
    background: var(--sidebar-active-bg);
    box-shadow: var(--primary-shadow) !important;
}

.nav-item svg, .nav-item i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    stroke-width: 2px;
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--sidebar-border);
    background-color: rgba(0, 0, 0, 0.15);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%) !important;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: var(--primary-shadow) !important;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Premium Main Content & Header */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header {
    position: sticky;
    top: 0;
    height: 70px;
    background-color: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--header-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    z-index: 100;
    transition: background-color 0.3s, border-color 0.3s;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 10px;
    color: var(--text-heading);
    cursor: pointer;
    transition: all 0.2s;
}
.menu-toggle:hover {
    background-color: var(--border-color);
}

.page-title {
    font-size: 1.45rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.5px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-search {
    position: relative;
}

.header-search input {
    width: 260px;
    padding: 0.625rem 1rem 0.625rem 2.75rem;
    border: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 12px;
    font-size: 0.875rem;
    color: var(--text-heading);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .header-search input {
    background-color: rgba(255, 255, 255, 0.03);
}

.header-search input:focus {
    width: 300px;
    outline: none;
    border-color: var(--primary);
    background-color: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.header-search svg {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.notification-btn {
    position: relative;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-heading);
    cursor: pointer;
    padding: 10px;
    border-radius: 12px;
    transition: all 0.2s;
}
.notification-btn:hover {
    background-color: var(--border-color);
}
.notification-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 10px;
    background-color: var(--danger) !important;
    border: 2px solid var(--bg-surface);
    border-radius: 50%;
    color: #FFFFFF;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 12px;
    transition: all 0.2s;
}
.user-dropdown-toggle:hover {
    background-color: var(--border-color);
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-heading);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.75rem;
    min-width: 220px;
    background-color: var(--bg-surface) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color) !important;
    border-radius: 16px !important;
    box-shadow: var(--card-shadow) !important;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    padding: 0.5rem 0;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-main);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.dropdown-menu a:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.dropdown-divider {
    height: 0;
    margin: 0.5rem 0;
    border-top: 1px solid var(--border-color);
}

/* Beautiful Floating Theme Toggle */
.theme-toggle-btn {
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    cursor: pointer;
    transition: all 0.2s;
    background-color: transparent;
}
.theme-toggle-btn:hover {
    background-color: var(--border-color);
}

/* Page Content Base */
.page-content {
    flex: 1;
    padding: 2rem;
}

/* Premium Dashboard Widgets */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px -8px var(--shadow-color);
}

.stat-content h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted) !important;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    color: var(--text-heading);
    line-height: 1;
}

.stat-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 8px 16px -4px rgba(0, 0, 0, 0.1);
}

.stat-icon.primary { background-color: var(--primary-light); color: var(--primary); }
.stat-icon.success { background-color: var(--success-light); color: var(--success); }
.stat-icon.warning { background-color: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background-color: var(--danger-light); color: var(--danger); }

/* Premium Cards */
.card {
    background: var(--bg-surface) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    box-shadow: var(--card-shadow) !important;
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s ease;
}

.card-header {
    padding: 1.25rem 1.75rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    background-color: var(--bg-surface-header) !important;
    backdrop-filter: blur(12px);
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body {
    padding: 1.75rem !important;
}

.card-footer {
    padding: 1.25rem 1.75rem !important;
    border-top: 1px solid var(--border-color) !important;
    background-color: var(--bg-surface-header) !important;
}

/* Table Aesthetics */
.table-responsive {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.table {
    margin-bottom: 0 !important;
    background-color: transparent !important;
    color: var(--text-main) !important;
}

.table th {
    background-color: var(--bg-surface-header) !important;
    color: var(--text-heading) !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 1px;
    padding: 1rem 1.25rem !important;
    border-bottom: 2px solid var(--border-color) !important;
}

.table td {
    padding: 1rem 1.25rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    color: var(--text-main) !important;
    font-size: 0.875rem;
    vertical-align: middle;
    background-color: transparent !important;
}

.table tbody tr {
    transition: background-color 0.15s ease;
}

.table tbody tr:hover {
    background-color: var(--primary-light) !important;
}

/* Beautiful Buttons */
.btn {
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-family: 'Outfit', sans-serif;
    padding: 0.625rem 1.5rem !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background-color: var(--primary) !important;
    border: 1px solid var(--primary) !important;
    color: #FFFFFF !important;
    box-shadow: var(--primary-shadow) !important;
}

.btn-primary:hover {
    background-color: var(--primary-hover) !important;
    border: 1px solid var(--primary-hover) !important;
    box-shadow: var(--primary-shadow-hover) !important;
    transform: translateY(-1px) !important;
}

.btn-secondary {
    background-color: var(--border-color) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-heading) !important;
}

.btn-secondary:hover {
    background-color: var(--text-muted) !important;
    color: #FFFFFF !important;
}

.btn-outline-primary {
    border: 2px solid var(--primary) !important;
    color: var(--primary) !important;
    background: transparent !important;
}

.btn-outline-primary:hover {
    background-color: var(--primary) !important;
    color: #FFFFFF !important;
}

/* Inputs & Form Controls */
.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 12px !important;
    border: 1px solid var(--border-color) !important;
    background-color: var(--bg-body) !important;
    color: var(--text-heading) !important;
    padding: 0.65rem 1rem !important;
    font-size: 0.875rem !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary) !important;
    background-color: var(--bg-surface) !important;
    box-shadow: 0 0 0 3px var(--primary-light) !important;
    outline: none !important;
}

.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.6;
}

/* Stat Badges */
.badge {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    border-radius: 30px !important;
    font-family: 'Outfit', sans-serif;
}
.badge-primary { background-color: var(--primary-light) !important; color: var(--primary) !important; }
.badge-success { background-color: var(--success-light) !important; color: var(--success) !important; }
.badge-warning { background-color: var(--warning-light) !important; color: var(--warning) !important; }
.badge-danger { background-color: var(--danger-light) !important; color: var(--danger) !important; }
.badge-info { background-color: var(--info-light) !important; color: var(--info) !important; }

/* Alerts */
.alert {
    border-radius: 16px !important;
    border: 1px solid transparent !important;
    padding: 1rem 1.5rem !important;
    font-size: 0.875rem !important;
    backdrop-filter: blur(8px);
}
.alert-success {
    background-color: var(--success-light) !important;
    border-color: rgba(52, 211, 153, 0.25) !important;
    color: var(--success) !important;
}
.alert-danger {
    background-color: var(--danger-light) !important;
    border-color: rgba(248, 113, 113, 0.25) !important;
    color: var(--danger) !important;
}
.alert-warning {
    background-color: var(--warning-light) !important;
    border-color: rgba(251, 191, 36, 0.25) !important;
    color: var(--warning) !important;
}
.alert-info {
    background-color: var(--info-light) !important;
    border-color: rgba(96, 165, 250, 0.25) !important;
    color: var(--info) !important;
}

/* Modals & Popups (Overriding Bootstrap naming clashes) */
.modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    background-color: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    z-index: 1050 !important;
}

.modal-overlay.active, 
.modal-overlay[style*="display: flex"], 
.modal-overlay[style*="display: block"] {
    display: flex !important;
}

/* Force Structure A card (.modal-overlay .modal) to center and look premium (Compact) */
.modal-overlay .modal {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 650px !important;
    height: auto !important;
    max-height: 90vh !important;
    background: var(--bg-surface) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    box-shadow: var(--card-shadow) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    transform: scale(1) !important;
    margin: auto !important;
    z-index: 1060 !important;
}

/* Force Structure B overlay (div.modal) to act as overlay */
div.modal {
    background-color: rgba(3, 7, 18, 0.45) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1050 !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 1rem !important;
    margin: 0 !important;
}

div.modal.active, 
div.modal[style*="display: flex"], 
div.modal[style*="display: block"] {
    display: flex !important;
}

/* Force Structure B card (.modal-content) to center and look premium (Compact) */
div.modal .modal-content {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    max-width: 650px !important;
    height: auto !important;
    max-height: 90vh !important;
    background: var(--bg-surface) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    box-shadow: var(--card-shadow) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: auto !important;
    padding: 0 !important;
}

/* Ensure modal form element is a flex container matching parent bounds to prevent cutting off footer buttons */
div.modal .modal-content > form,
.modal-overlay .modal > form {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    max-height: inherit !important;
    height: 100% !important;
    width: 100% !important;
}

.modal-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 0.85rem 1.25rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    background-color: var(--primary-light) !important;
    width: 100% !important;
}

.modal-header h3, .modal-header h4 {
    font-size: 1.15rem !important;
    margin: 0 !important;
    color: var(--primary) !important;
}

.modal-body {
    padding: 1.25rem !important;
    overflow-y: auto !important;
    width: 100% !important;
    color: var(--text-main) !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
}

/* Compact spacing for form controls inside modals */
.modal-body .form-group, .modal-body .mb-3 {
    margin-bottom: 0.85rem !important;
}

.modal-body .form-label {
    margin-bottom: 0.35rem !important;
    font-size: 0.8rem !important;
}

.modal-body .form-control, .modal-body .form-select {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.825rem !important;
    border-radius: 10px !important;
}

.modal-footer {
    display: flex !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.85rem 1.25rem !important;
    border-top: 1px solid var(--border-color) !important;
    background-color: var(--bg-surface-header) !important;
    width: 100% !important;
    flex-shrink: 0 !important;
}

.modal-footer .btn {
    padding: 0.45rem 1.15rem !important;
    font-size: 0.8rem !important;
    border-radius: 10px !important;
}

.modal-close {
    background: none !important;
    border: none !important;
    font-size: 1.5rem !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    line-height: 1 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0.7 !important;
    transition: opacity 0.2s !important;
}
.modal-close:hover {
    color: var(--text-heading) !important;
    opacity: 1 !important;
}

/* Premium Auth Pages Layout */
.auth-body {
    background-color: #030712 !important;
    background-image: 
        radial-gradient(at 0% 0%, hsla(244, 98%, 58%, 0.12) 0px, transparent 50%), 
        radial-gradient(at 100% 100%, hsla(263, 90%, 51%, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 50%, hsla(220, 80%, 50%, 0.05) 0px, transparent 80%) !important;
    min-height: 100vh;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.auth-card {
    background: rgba(17, 24, 39, 0.75) !important;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    border-radius: 28px !important;
    width: 100%;
    max-width: 460px;
    padding: 2.75rem !important;
    box-shadow: 0 25px 70px -15px rgba(0, 0, 0, 0.6) !important;
    color: #F3F4F6;
    position: relative;
    overflow: hidden;
}

.auth-card h1, .auth-card h2, .auth-card h3, .auth-card h4, .auth-card .form-label {
    color: #FFFFFF !important;
}

.auth-card .form-control {
    background-color: rgba(3, 7, 18, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #FFFFFF !important;
}

.auth-card .form-control:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.25) !important;
}

.auth-card .auth-logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: -1px;
    background: linear-gradient(135deg, #FFD83B 0%, #FF4572 50%, #7645FF 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-card .auth-logo p {
    font-size: 0.8rem;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 2px;
    margin-top: 0.25rem;
}

.auth-card .auth-title {
    margin-bottom: 2rem;
    text-align: center;
}

.auth-card .auth-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.auth-card .auth-title p {
    color: #94A3B8;
    font-size: 0.875rem;
}

.auth-card .trial-badge {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25) 0%, rgba(5, 150, 105, 0.25) 100%);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34D399;
    padding: 0.75rem;
    border-radius: 14px;
    text-align: center;
    margin-bottom: 2rem;
}
.auth-card .trial-badge h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #34D399 !important;
}
.auth-card .trial-badge p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.9;
    color: #A7F3D0;
}

.auth-card .auth-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.875rem;
    color: #94A3B8;
}

.auth-card .auth-footer a {
    color: var(--primary);
    font-weight: 600;
}
.auth-card .auth-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Floating theme switch on auth */
.auth-theme-toggle {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    border-radius: 12px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.auth-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-item {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-item:hover {
    color: var(--text-heading);
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

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

/* Pagination Design */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 2rem;
}

.pagination ul {
    display: flex;
    list-style: none;
    gap: 0.35rem;
    padding: 0;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.85rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    background-color: var(--bg-surface);
    transition: all 0.2s;
}

.pagination a:hover {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.pagination li.active span {
    background: var(--sidebar-active-bg);
    border-color: var(--primary);
    color: #FFFFFF;
    box-shadow: var(--primary-shadow) !important;
}

/* Form Row Helper (Flexible Multi-Column support) */
.form-row {
    display: flex !important;
    flex-wrap: wrap !important;
    margin-right: -0.625rem !important;
    margin-left: -0.625rem !important;
    margin-bottom: 0.25rem !important;
    width: 100% !important;
}

.form-row > [class*="col-"], .form-row > div {
    padding-right: 0.625rem !important;
    padding-left: 0.625rem !important;
    flex-shrink: 0 !important;
    width: 100% !important;
}

/* Specific column configurations for flex grid */
.col-md-8 { flex: 0 0 66.666667% !important; max-width: 66.666667% !important; }
.col-md-4 { flex: 0 0 33.333333% !important; max-width: 33.333333% !important; }
.col-md-6 { flex: 0 0 50% !important; max-width: 50% !important; }
.col-md-12 { flex: 0 0 100% !important; max-width: 100% !important; }

/* Premium Software Checkbox/Toggle Styling */
input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 1.15rem !important;
    height: 1.15rem !important;
    border: 1.5px solid var(--border-color) !important;
    border-radius: 6px !important;
    background-color: var(--bg-body) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    position: relative !important;
    vertical-align: middle !important;
}

input[type="checkbox"]:checked {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
}

input[type="checkbox"]:checked::after {
    content: "\F272" !important; /* Bootstrap check code */
    font-family: "bootstrap-icons" !important;
    color: #FFFFFF !important;
    font-size: 0.75rem !important;
    font-weight: 900 !important;
}

/* For Active toggle (Success state) */
#is_active {
    width: 2.2rem !important;
    height: 1.2rem !important;
    border-radius: 20px !important;
    background-color: #E2E8F0 !important;
    position: relative !important;
}

[data-theme="dark"] #is_active {
    background-color: #334155 !important;
}

#is_active:checked {
    background-color: var(--success) !important;
    border-color: var(--success) !important;
}

#is_active::after {
    content: "" !important;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    background-color: #FFFFFF !important;
    transition: transform 0.2s ease !important;
}

#is_active:checked::after {
    transform: translateX(16px) !important;
}

/* Overnight switch (Warning / Alert state) */
#is_overnight {
    width: 2.2rem !important;
    height: 1.2rem !important;
    border-radius: 20px !important;
    background-color: #E2E8F0 !important;
    position: relative !important;
}

[data-theme="dark"] #is_overnight {
    background-color: #334155 !important;
}

#is_overnight:checked {
    background-color: var(--warning) !important;
    border-color: var(--warning) !important;
}

#is_overnight::after {
    content: "" !important;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    background-color: #FFFFFF !important;
    transition: transform 0.2s ease !important;
}

#is_overnight:checked::after {
    transform: translateX(16px) !important;
}

/* Flexible Timing switch (Info state) */
#is_flexible {
    width: 2.2rem !important;
    height: 1.2rem !important;
    border-radius: 20px !important;
    background-color: #E2E8F0 !important;
    position: relative !important;
}

[data-theme="dark"] #is_flexible {
    background-color: #334155 !important;
}

#is_flexible:checked {
    background-color: var(--info) !important;
    border-color: var(--info) !important;
}

#is_flexible::after {
    content: "" !important;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: 14px !important;
    height: 14px !important;
    border-radius: 50% !important;
    background-color: #FFFFFF !important;
    transition: transform 0.2s ease !important;
}

#is_flexible:checked::after {
    transform: translateX(16px) !important;
}


/* Premium Sidebar Backdrop Overlay */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(9, 30, 66, 0.5); /* Cozy Atlassian deep blue semi-transparent overlay */
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive Overrides */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 10px 40px -5px rgba(9, 30, 66, 0.5) !important;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .header-search {
        display: none;
    }
}

@media (max-width: 991px) {
    /* Atlassian-Style Responsive Grid Interceptor & Overrider for inline grid layout column elements */
    .app-wrapper [style*="grid-template-columns: 2fr 1fr"],
    .app-wrapper [style*="grid-template-columns: 1fr 1fr"],
    .app-wrapper [style*="grid-template-columns: 300px 1fr"],
    .app-wrapper [style*="grid-template-columns: repeat(2"],
    .app-wrapper [style*="grid-template-columns: repeat(3"],
    .app-wrapper [style*="grid-template-columns: repeat(4"] {
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
}

@media (max-width: 768px) {
    .auth-card {
        padding: 2rem !important;
        margin: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem !important;
    }

    .page-content {
        padding: 1rem !important;
    }

    .form-row {
        flex-direction: column !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    
    .form-row > [class*="col-"], .form-row > div {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding-right: 0 !important;
        padding-left: 0 !important;
        margin-bottom: 0.85rem !important;
    }
    
    .form-row > [class*="col-"]:last-child, .form-row > div:last-child {
        margin-bottom: 0 !important;
    }

    .modal {
        margin: 0.5rem;
        border-radius: 16px !important;
    }
    
    /* Cozy and responsive table aesthetics */
    .table-responsive {
        border: 1px solid var(--border-color) !important;
        border-radius: 12px !important;
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
    }
    .table-responsive::-webkit-scrollbar {
        height: 6px;
        width: 6px;
    }
    .table-responsive::-webkit-scrollbar-track {
        background: transparent;
    }
    .table-responsive::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 10px;
    }
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: var(--text-muted);
    }
    
    .table th, .table td {
        padding: 0.75rem 1rem !important;
        font-size: 0.825rem !important;
    }
}

@media (max-width: 576px) {
    /* Responsive auto-fit or auto-fill override to prevent viewport overflowing */
    .app-wrapper [style*="minmax("] {
        grid-template-columns: 1fr !important;
    }

    .header {
        padding: 0 1rem !important;
        height: 60px !important;
    }
    
    .page-title {
        font-size: 1.15rem !important;
        letter-spacing: -0.3px !important;
    }
    
    .user-avatar {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.8rem !important;
    }
    
    .user-dropdown-toggle {
        padding: 4px !important;
    }
    
    .theme-toggle-btn, .notification-btn {
        padding: 6px !important;
    }
    
    .page-content {
        padding: 0.75rem !important;
    }
    
    .card {
        margin-bottom: 0.75rem !important;
        border-radius: 14px !important;
    }
    
    .card-header {
        padding: 0.875rem 1rem !important;
        flex-direction: row !important;
        align-items: center !important;
    }
    
    .card-header h4 {
        font-size: 1rem !important;
        margin-bottom: 0 !important;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .card-footer {
        padding: 0.875rem 1rem !important;
    }
    
    /* Cozy and touch-friendly buttons on mobile */
    .btn {
        padding: 0.5rem 1rem !important;
        font-size: 0.85rem !important;
        border-radius: 10px !important;
    }
    
    /* Quick stats micro alignment */
    .stat-card {
        padding: 1rem !important;
    }
    
    .stat-title {
        font-size: 0.75rem !important;
    }
    
    .stat-value {
        font-size: 1.35rem !important;
    }
}

/* Print Styles */
@media print {
    .sidebar, .header, .btn, .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .page-content {
        padding: 0;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* Legacy Utility Classes */
.d-flex { display: flex !important; }
.d-none { display: none !important; }
.d-block { display: block !important; }
.flex-column { flex-direction: column !important; }
.align-center { align-items: center !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-1 { gap: 0.25rem !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }
.gap-4 { gap: 1.5rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }
.text-left { text-align: left !important; }
.font-bold { font-weight: 700 !important; }
.font-medium { font-weight: 500 !important; }
.w-100 { width: 100% !important; }
.rounded { border-radius: var(--radius) !important; }

/* Custom Button Outline Styling */
.btn-outline {
    background-color: transparent !important;
    border: 1.5px solid var(--border-color) !important;
    color: var(--text-main) !important;
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--primary-light) !important;
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

/* Premium Shift Card Styling */
.shift-card {
    background: var(--bg-surface) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    box-shadow: var(--card-shadow) !important;
    padding: 1.75rem !important;
    margin-bottom: 1.5rem !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s !important;
}

.shift-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 15px 35px -8px var(--shadow-color) !important;
}

.shift-code {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    padding: 0.35rem 0.65rem !important;
    border-radius: 8px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    display: inline-block !important;
}

.shift-timing {
    color: var(--primary) !important;
    font-family: 'Outfit', sans-serif !important;
    font-size: 1.65rem !important;
    font-weight: 800 !important;
}

/* ==========================================================================
   Collapsible Sidebar System (Jira Style)
   ========================================================================== */
@media (min-width: 1025px) {
    /* Always display the collapse toggle button on desktop */
    .menu-toggle {
        display: block !important;
    }
    
    /* Collapsed Sidebar */
    .app-wrapper.sidebar-collapsed .sidebar {
        width: 72px !important;
        transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    /* Collapsed Main Content margin offset */
    .app-wrapper.sidebar-collapsed .main-content {
        margin-left: 72px !important;
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
    
    /* Hide Logo text, show only fingerprint icon centered */
    .app-wrapper.sidebar-collapsed .sidebar-logo {
        justify-content: center !important;
        padding: 0 !important;
    }
    .app-wrapper.sidebar-collapsed .sidebar-logo span {
        display: none !important;
    }
    
    /* Hide navigation section headers (e.g. Main, Employee Management) */
    .app-wrapper.sidebar-collapsed .nav-section-title {
        display: none !important;
    }
    
    /* Adjust navigation items */
    .app-wrapper.sidebar-collapsed .nav-item {
        justify-content: center !important;
        padding: 0.75rem 0 !important;
        margin: 0.25rem 0.5rem !important;
        border-radius: 10px !important;
        gap: 0 !important;
    }
    .app-wrapper.sidebar-collapsed .nav-item:hover {
        transform: none !important;
    }
    /* Hide navigation text, keep only icon */
    .app-wrapper.sidebar-collapsed .nav-item {
        font-size: 0 !important;
    }
    .app-wrapper.sidebar-collapsed .nav-item svg,
    .app-wrapper.sidebar-collapsed .nav-item i {
        margin: 0 !important;
        width: 22px !important;
        height: 22px !important;
    }
    
    /* Center the footer avatar, hide username and role info */
    .app-wrapper.sidebar-collapsed .sidebar-footer {
        padding: 1rem 0.5rem !important;
        display: flex !important;
        justify-content: center !important;
    }
    .app-wrapper.sidebar-collapsed .sidebar-footer .d-flex {
        justify-content: center !important;
        width: 100% !important;
    }
    .app-wrapper.sidebar-collapsed .sidebar-footer .overflow-hidden {
        display: none !important;
    }
}

/* Responsive Action Card Headers & Alignment (Jira mobile styling) */
@media (max-width: 576px) {
    .card-body.d-flex.justify-between.align-center {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }
    
    .card-body.d-flex.justify-between.align-center button,
    .card-body.d-flex.justify-between.align-center a,
    .card-body.d-flex.justify-between.align-center .btn {
        width: 100% !important;
        text-align: center !important;
        justify-content: center !important;
        display: flex !important;
    }
}

/* Responsive Salary Structure Grid Layouts */
@media (max-width: 991px) {
    .salary-employee-grid {
        grid-template-columns: 1fr !important;
    }
    .salary-components-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Mobile Cozy Employee Card Layout & Details Expansion */
.mobile-employee-list {
    display: none !important;
}

@media (max-width: 768px) {
    /* Hide the desktop wide employee table */
    .table-responsive {
        display: none !important;
    }
    
    /* Display cozy mobile list cards */
    .mobile-employee-list {
        display: block !important;
    }
    
    .mobile-employee-card {
        background-color: var(--bg-surface) !important;
        border: 1.5px solid var(--border-color) !important;
        border-radius: 16px !important;
        padding: 1.15rem !important;
        cursor: pointer;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
        margin-bottom: 0.5rem;
    }
    
    [data-theme="dark"] .mobile-employee-card {
        background-color: rgba(255, 255, 255, 0.02) !important;
    }
    
    .mobile-employee-card:hover, .mobile-employee-card.expanded {
        border-color: var(--primary) !important;
        box-shadow: 0 10px 25px -5px var(--shadow-color) !important;
    }
    
    .mobile-employee-card .mobile-card-chevron {
        font-size: 1.15rem;
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .mobile-employee-card.expanded .mobile-card-chevron {
        transform: rotate(90deg);
        color: var(--primary) !important;
    }
    
    .mobile-employee-details {
        animation: slideDownFade 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

@keyframes slideDownFade {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cozy Mobile Filter Form & Dropdown Search Box Restructuring */
@media (max-width: 768px) {
    .card-body form.d-flex,
    .card form.d-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }
    
    .card-body form.d-flex .form-group,
    .card form.d-flex .form-group {
        width: 100% !important;
        margin-bottom: 0 !important;
        flex: none !important;
    }
    
    .card-body form.d-flex select,
    .card-body form.d-flex input,
    .card form.d-flex select,
    .card form.d-flex input {
        width: 100% !important;
    }
    
    /* Buttons in filter forms */
    .card-body form.d-flex button,
    .card-body form.d-flex a.btn,
    .card form.d-flex button,
    .card form.d-flex a.btn {
        width: 100% !important;
        justify-content: center !important;
    }
}

