/* ============================================
   FACTUKON THEME - Modern Client Portal
   ============================================ */

:root {
    --fk-primary: #3B82F6;
    --fk-primary-hover: #2563EB;
    --fk-primary-light: #DBEAFE;
    --fk-sidebar-bg: #0F172A;
    --fk-sidebar-hover: #1E293B;
    --fk-sidebar-active: rgba(59, 130, 246, 0.15);
    --fk-sidebar-text: #94A3B8;
    --fk-sidebar-text-active: #F8FAFC;
    --fk-sidebar-width: 260px;
    --fk-header-height: 60px;
    --fk-bg: #F1F5F9;
    --fk-card-bg: #FFFFFF;
    --fk-text: #1E293B;
    --fk-text-light: #64748B;
    --fk-text-muted: #94A3B8;
    --fk-border: #E2E8F0;
    --fk-success: #10B981;
    --fk-success-light: #D1FAE5;
    --fk-warning: #F59E0B;
    --fk-warning-light: #FEF3C7;
    --fk-danger: #EF4444;
    --fk-danger-light: #FEE2E2;
    --fk-purple: #8B5CF6;
    --fk-purple-light: #EDE9FE;
    --fk-amber: #F59E0B;
    --fk-amber-light: #FEF3C7;
    --fk-radius: 12px;
    --fk-radius-sm: 8px;
    --fk-radius-xs: 6px;
    --fk-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --fk-shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --fk-shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
    --fk-transition: all 0.2s ease;
}

/* ---- Reset & Base ---- */
body.fk-active {
    background: var(--fk-bg) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif !important;
    color: var(--fk-text);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body.fk-active * {
    font-family: inherit;
}

/* ---- Hide original navbar ---- */
body.fk-active > nav.navbar,
body.fk-active > .navbar {
    display: none !important;
}

/* ---- Sidebar ---- */
#fk-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--fk-sidebar-width);
    height: 100vh;
    background: var(--fk-sidebar-bg);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

#fk-sidebar.collapsed {
    transform: translateX(calc(var(--fk-sidebar-width) * -1));
}

.fk-sidebar-brand {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    min-height: 64px;
}

.fk-logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.fk-logo-mark svg {
    width: 20px;
    height: 20px;
}

.fk-brand-name {
    font-size: 18px;
    font-weight: 700;
    color: #F8FAFC;
    letter-spacing: -0.3px;
}

.fk-brand-name span {
    color: var(--fk-primary);
}

/* ---- Sidebar Nav ---- */
.fk-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.fk-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}
.fk-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

.fk-nav-section {
    margin-bottom: 4px;
}

.fk-nav-section-title {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: rgba(148, 163, 184, 0.6);
    user-select: none;
}

.fk-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 20px;
    color: var(--fk-sidebar-text);
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 450;
    transition: var(--fk-transition);
    border-left: 3px solid transparent;
    cursor: pointer;
}

.fk-nav-item:hover {
    background: var(--fk-sidebar-hover);
    color: var(--fk-sidebar-text-active);
}

.fk-nav-item.active {
    background: var(--fk-sidebar-active);
    color: var(--fk-primary);
    border-left-color: var(--fk-primary);
    font-weight: 500;
}

.fk-nav-item i {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: 0.8;
}

.fk-nav-item.active i {
    opacity: 1;
}

/* ---- Sidebar section toggle ---- */
.fk-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 20px;
    color: var(--fk-sidebar-text);
    font-size: 14px;
    font-weight: 450;
    cursor: pointer;
    transition: var(--fk-transition);
    border-left: 3px solid transparent;
    user-select: none;
}

.fk-nav-toggle:hover {
    background: var(--fk-sidebar-hover);
    color: var(--fk-sidebar-text-active);
}

.fk-nav-toggle .fk-toggle-icon {
    font-size: 10px;
    transition: transform 0.2s ease;
}

.fk-nav-toggle.open .fk-toggle-icon {
    transform: rotate(90deg);
}

.fk-nav-subitems {
    display: none;
    padding-left: 12px;
}

.fk-nav-subitems.open {
    display: block;
}

/* ---- Sidebar Footer ---- */
.fk-sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.fk-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: var(--fk-radius-sm);
    color: var(--fk-sidebar-text);
    margin-bottom: 4px;
}

.fk-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.fk-user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--fk-sidebar-text-active);
}

.fk-user-role {
    font-size: 11px;
    color: var(--fk-sidebar-text);
}

/* ---- Header ---- */
#fk-header {
    position: fixed;
    top: 0;
    left: var(--fk-sidebar-width);
    right: 0;
    height: var(--fk-header-height);
    background: var(--fk-card-bg);
    border-bottom: 1px solid var(--fk-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1040;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#fk-header.expanded {
    left: 0;
}

#fk-sidebar-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    border-radius: var(--fk-radius-xs);
    cursor: pointer;
    color: var(--fk-text-light);
    font-size: 18px;
    transition: var(--fk-transition);
}

#fk-sidebar-toggle:hover {
    background: var(--fk-bg);
    color: var(--fk-text);
}

.fk-header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--fk-text);
}

.fk-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fk-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--fk-radius-sm);
    color: var(--fk-text-light);
    text-decoration: none !important;
    transition: var(--fk-transition);
    font-size: 16px;
}

.fk-header-btn:hover {
    background: var(--fk-bg);
    color: var(--fk-primary);
}

/* ---- Main Content Area ---- */
#fk-main {
    margin-left: var(--fk-sidebar-width);
    margin-top: var(--fk-header-height);
    padding: 24px;
    min-height: calc(100vh - var(--fk-header-height));
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#fk-main.expanded {
    margin-left: 0;
}

/* ---- Cards ---- */
body.fk-active .card,
.fk-card {
    background: var(--fk-card-bg);
    border: 1px solid var(--fk-border);
    border-radius: var(--fk-radius) !important;
    box-shadow: var(--fk-shadow);
    overflow: hidden;
    transition: var(--fk-transition);
}

body.fk-active .card:hover,
.fk-card:hover {
    box-shadow: var(--fk-shadow-md);
}

body.fk-active .card-header,
.fk-card-header {
    background: var(--fk-card-bg) !important;
    border-bottom: 1px solid var(--fk-border) !important;
    padding: 16px 20px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.fk-card-header h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--fk-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.fk-card-header h5 i {
    color: var(--fk-primary);
    font-size: 14px;
}

.fk-card-link {
    font-size: 13px;
    color: var(--fk-primary) !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: var(--fk-transition);
}

.fk-card-link:hover {
    color: var(--fk-primary-hover) !important;
}

body.fk-active .card-body,
.fk-card-body {
    padding: 20px !important;
}

/* ---- Stat Cards ---- */
.fk-stat-card {
    background: var(--fk-card-bg);
    border: 1px solid var(--fk-border);
    border-radius: var(--fk-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--fk-shadow);
    transition: var(--fk-transition);
}

.fk-stat-card:hover {
    box-shadow: var(--fk-shadow-md);
    transform: translateY(-2px);
}

.fk-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.fk-icon-blue {
    background: var(--fk-primary-light);
    color: var(--fk-primary);
}

.fk-icon-green {
    background: var(--fk-success-light);
    color: var(--fk-success);
}

.fk-icon-purple {
    background: var(--fk-purple-light);
    color: var(--fk-purple);
}

.fk-icon-amber {
    background: var(--fk-amber-light);
    color: var(--fk-amber);
}

.fk-stat-info {
    display: flex;
    flex-direction: column;
}

.fk-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--fk-text);
    line-height: 1.2;
}

.fk-stat-label {
    font-size: 13px;
    color: var(--fk-text-light);
    font-weight: 450;
}

/* ---- Welcome Banner ---- */
.fk-welcome-banner {
    background: linear-gradient(135deg, #1E40AF, #3B82F6);
    border-radius: var(--fk-radius);
    padding: 28px 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.fk-welcome-text h2 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: white;
}

.fk-welcome-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.85;
}

.fk-welcome-date {
    font-size: 14px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Action Buttons ---- */
.fk-actions-card .fk-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.fk-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--fk-radius-sm);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none !important;
    transition: var(--fk-transition);
    cursor: pointer;
}

.fk-action-btn i {
    width: 18px;
    text-align: center;
}

.fk-action-primary {
    background: var(--fk-primary);
    color: white !important;
}

.fk-action-primary:hover {
    background: var(--fk-primary-hover);
    transform: translateX(4px);
}

.fk-action-green {
    background: var(--fk-success);
    color: white !important;
}

.fk-action-green:hover {
    background: #059669;
    transform: translateX(4px);
}

.fk-action-purple {
    background: var(--fk-purple);
    color: white !important;
}

.fk-action-purple:hover {
    background: #7C3AED;
    transform: translateX(4px);
}

.fk-action-outline {
    background: transparent;
    color: var(--fk-text-light) !important;
    border: 1px solid var(--fk-border);
}

.fk-action-outline:hover {
    background: var(--fk-bg);
    color: var(--fk-primary) !important;
    border-color: var(--fk-primary);
    transform: translateX(4px);
}

/* ---- Tables ---- */
.fk-table {
    width: 100%;
    border-collapse: collapse;
}

.fk-table thead th {
    font-size: 12px;
    font-weight: 600;
    color: var(--fk-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    border-bottom: 2px solid var(--fk-border);
}

.fk-table tbody td {
    padding: 12px;
    font-size: 14px;
    color: var(--fk-text);
    border-bottom: 1px solid var(--fk-border);
}

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

.fk-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.03);
}

.fk-table a {
    color: var(--fk-primary) !important;
    text-decoration: none !important;
    font-weight: 500;
}

.fk-table a:hover {
    text-decoration: underline !important;
}

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

.fk-badge-success {
    background: var(--fk-success-light);
    color: var(--fk-success);
}

.fk-badge-warning {
    background: var(--fk-warning-light);
    color: var(--fk-warning);
}

.fk-badge-danger {
    background: var(--fk-danger-light);
    color: var(--fk-danger);
}

/* ---- Empty State ---- */
.fk-empty-state {
    text-align: center;
    padding: 32px 20px;
}

.fk-empty-state i {
    font-size: 40px;
    color: var(--fk-border);
    margin-bottom: 12px;
}

.fk-empty-state p {
    color: var(--fk-text-light);
    margin-bottom: 16px;
}

.fk-btn-small {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--fk-primary);
    color: white !important;
    border-radius: var(--fk-radius-xs);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none !important;
    transition: var(--fk-transition);
}

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

/* ---- Global Bootstrap Overrides ---- */
body.fk-active .btn-primary,
body.fk-active .btn-primary:focus {
    background: var(--fk-primary) !important;
    border-color: var(--fk-primary) !important;
    border-radius: var(--fk-radius-sm) !important;
    font-weight: 500;
    box-shadow: none !important;
}

body.fk-active .btn-primary:hover {
    background: var(--fk-primary-hover) !important;
    border-color: var(--fk-primary-hover) !important;
}

body.fk-active .btn {
    border-radius: var(--fk-radius-sm) !important;
    font-weight: 500;
    transition: var(--fk-transition);
}

body.fk-active .form-control,
body.fk-active .form-select {
    border-radius: var(--fk-radius-sm) !important;
    border-color: var(--fk-border) !important;
    font-size: 14px;
    padding: 8px 12px;
    transition: var(--fk-transition);
}

body.fk-active .form-control:focus,
body.fk-active .form-select:focus {
    border-color: var(--fk-primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

body.fk-active .table {
    border-radius: var(--fk-radius-sm);
    overflow: hidden;
}

body.fk-active .table thead th {
    background: var(--fk-bg) !important;
    border-bottom: 2px solid var(--fk-border) !important;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--fk-text-light) !important;
    padding: 10px 12px;
}

body.fk-active .table tbody td {
    padding: 10px 12px;
    font-size: 14px;
    border-bottom: 1px solid var(--fk-border) !important;
    vertical-align: middle;
}

body.fk-active .table tbody tr:hover {
    background: rgba(59, 130, 246, 0.03) !important;
}

body.fk-active .page-link {
    border-radius: var(--fk-radius-xs) !important;
    color: var(--fk-primary);
    border-color: var(--fk-border);
}

body.fk-active .page-item.active .page-link {
    background: var(--fk-primary) !important;
    border-color: var(--fk-primary) !important;
}

body.fk-active h1, body.fk-active h2, body.fk-active h3 {
    color: var(--fk-text);
    font-weight: 700;
}

/* ---- FS-specific overrides ---- */
body.fk-active .container-fluid {
    padding: 0 !important;
}

body.fk-active footer {
    display: none !important;
}

body.fk-active .alert {
    border-radius: var(--fk-radius-sm) !important;
    border: none !important;
    font-size: 14px;
}

body.fk-active .dropdown-menu {
    border-radius: var(--fk-radius-sm) !important;
    border: 1px solid var(--fk-border) !important;
    box-shadow: var(--fk-shadow-lg) !important;
    padding: 4px !important;
}

body.fk-active .dropdown-item {
    border-radius: var(--fk-radius-xs) !important;
    padding: 8px 12px !important;
    font-size: 14px;
    transition: var(--fk-transition);
}

body.fk-active .dropdown-item:hover {
    background: var(--fk-bg) !important;
    color: var(--fk-primary) !important;
}

body.fk-active .modal-content {
    border-radius: var(--fk-radius) !important;
    border: none !important;
    box-shadow: var(--fk-shadow-lg);
}

body.fk-active .modal-header {
    border-bottom: 1px solid var(--fk-border);
}

body.fk-active .modal-footer {
    border-top: 1px solid var(--fk-border);
}

body.fk-active .nav-tabs {
    border-bottom: 2px solid var(--fk-border);
}

body.fk-active .nav-tabs .nav-link {
    border: none !important;
    border-bottom: 2px solid transparent !important;
    margin-bottom: -2px;
    color: var(--fk-text-light);
    font-weight: 500;
    font-size: 14px;
    padding: 10px 16px;
    transition: var(--fk-transition);
}

body.fk-active .nav-tabs .nav-link.active,
body.fk-active .nav-tabs .nav-link:hover {
    color: var(--fk-primary) !important;
    border-bottom-color: var(--fk-primary) !important;
    background: transparent !important;
}

/* ---- Sidebar overlay for mobile ---- */
#fk-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1045;
    backdrop-filter: blur(2px);
}

#fk-sidebar-overlay.visible {
    display: block;
}

/* ---- Responsive ---- */
@media (max-width: 991px) {
    #fk-sidebar {
        transform: translateX(calc(var(--fk-sidebar-width) * -1));
    }

    #fk-sidebar.open {
        transform: translateX(0);
    }

    #fk-header {
        left: 0;
    }

    #fk-main {
        margin-left: 0;
    }

    #fk-sidebar-toggle {
        display: flex;
    }

    .fk-welcome-banner {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }
}

@media (max-width: 576px) {
    #fk-main {
        padding: 16px;
    }

    .fk-welcome-banner {
        padding: 20px;
    }

    .fk-welcome-text h2 {
        font-size: 18px;
    }

    .fk-stat-card {
        padding: 16px;
    }

    .fk-stat-value {
        font-size: 20px;
    }
}

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

/* ---- Scrollbar global ---- */
body.fk-active ::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

body.fk-active ::-webkit-scrollbar-track {
    background: transparent;
}

body.fk-active ::-webkit-scrollbar-thumb {
    background: var(--fk-border);
    border-radius: 3px;
}

body.fk-active ::-webkit-scrollbar-thumb:hover {
    background: var(--fk-text-muted);
}

/* ---- Animations ---- */
@keyframes fk-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fk-dashboard .fk-stat-card,
.fk-dashboard .fk-card {
    animation: fk-fadeIn 0.3s ease forwards;
}

.fk-dashboard .row:nth-child(2) .fk-stat-card:nth-child(1) { animation-delay: 0.05s; }
.fk-dashboard .row:nth-child(2) .fk-stat-card:nth-child(2) { animation-delay: 0.1s; }
.fk-dashboard .row:nth-child(2) .fk-stat-card:nth-child(3) { animation-delay: 0.15s; }
.fk-dashboard .row:nth-child(2) .fk-stat-card:nth-child(4) { animation-delay: 0.2s; }

/* ---- Login page override ---- */
body.fk-active-login {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%) !important;
}
