/* ============================================================
   Feoin Design System v2.0
   Shared component styles for all pages
   Contains: Base styles, components, dark mode overrides
   ============================================================ */

/* --- Base Typography --- */
body {
    font-family: 'Manrope', 'PingFang SC', sans-serif;
    background-color: #f8f9ff;
    color: #051c33;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 {
    font-family: 'Hanken Grotesk', 'PingFang SC', sans-serif;
    letter-spacing: -0.02em;
}
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}

/* --- Layout Utilities --- */
.docked { width: 100%; }
.full-width { width: 100%; }
.px-margin-desktop { padding-left: 5rem; padding-right: 5rem; }
.max-w-max-width { max-width: 1280px; }
.hero-gradient { background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%); }
.gap-gutter { gap: 1.5rem; }

/* --- Logo Styles --- */
.fn-logo-img {
    height: 28px;
    width: auto;
    flex-shrink: 0;
}
nav img[data-desktop-logo] {
    display: block;
}
nav img[data-mobile-logo] {
    display: none;
}

/* --- Data Icon Styles --- */
span[data-icon] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    padding: 0;
    margin: 0;
    line-height: 1;
}
span[data-icon] svg {
    background: transparent !important;
    fill: none !important;
}

/* --- Top Navigation (Classic style with search) --- */
.fn-topnav-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f1f5f9;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
}
.fn-topnav-search input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.8125rem;
    color: #051c33;
    width: 8rem;
}
.fn-topnav-search input::placeholder { color: #94a3b8; }
.fn-topnav-search .kbd {
    font-size: 0.625rem;
    color: #94a3b8;
    background: #e2e8f0;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}
.fn-topnav-avatar img {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    object-fit: cover;
}
.fn-topnav-dot {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 0.5rem;
    height: 0.5rem;
    background: #ef4444;
    border-radius: 9999px;
    border: 2px solid white;
}

/* --- Icon Buttons (Theme toggle, notification) --- */
.fn-theme-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    border-radius: 0.5rem;
    transition: all 0.15s;
    background: transparent;
    border: none;
    cursor: pointer;
    position: relative;
}
.fn-theme-btn:hover { background: #f1f5f9; color: #051c33; }
.fn-theme-btn:focus-visible { outline: 2px solid #0047d4; outline-offset: 2px; }

/* --- Sidebar --- */
.fn-sidebar {
    position: fixed;
    left: 0;
    top: 4rem;
    height: calc(100vh - 4rem);
    width: 260px;
    background: white;
    border-right: 1px solid rgba(226, 232, 240, 0.3);
    display: none;
    flex-direction: column;
    padding: 1.5rem;
    gap: 0.5rem;
    z-index: 40;
}
@media (min-width: 768px) { .fn-sidebar { display: flex; } }
.fn-sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    color: #434656;
    border-radius: 0.75rem;
    text-decoration: none;
    transition: all 0.15s;
    font-size: 0.9375rem;
}
.fn-sidebar-link:hover { background: #eff4ff; }
.fn-sidebar-link.active {
    background: rgba(0, 71, 212, 0.05);
    color: #0047d4;
    font-weight: 700;
}

/* --- Cards --- */
.fn-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 2px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
}
.fn-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}
.fn-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: transparent;
}
.fn-card-title {
    font-size: 1rem; font-weight: 600;
    color: #051c33; margin: 0;
}
.fn-card-body {
    padding: 1.25rem;
}
.dark .fn-card-header {
    border-bottom-color: rgba(51, 65, 85, 0.5) !important;
}
.dark .fn-card-title {
    color: #f1f5f9 !important;
}

/* --- Buttons --- */
.fn-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: #0047d4;
    color: white;
    border-radius: 0.75rem;
    font-weight: 700;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.fn-btn-primary:hover { background: #205ffe; }
.fn-btn-primary:active { transform: scale(0.97); }

.fn-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: #543edf;
    color: white;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}
.fn-btn-secondary:hover { opacity: 0.9; }
.fn-btn-secondary:active { transform: scale(0.95); }

.fn-btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: transparent;
    color: #434656;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s;
}
.fn-btn-outline:hover { background: #f8f9ff; }

/* --- Footer --- */
.fn-footer {
    padding: 2rem 0;
    border-top: 1px solid rgba(226, 232, 240, 0.3);
    background: white;
    text-align: center;
}
.fn-footer p {
    font-size: 0.875rem;
    color: rgba(67, 70, 86, 0.6);
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ============================================================
   Dark Mode Overrides
   ============================================================ */

/* --- Base --- */
.dark body { background-color: #0f172a !important; color: #f1f5f9 !important; }

/* --- Navigation --- */
.dark .fn-topnav { background: rgba(15, 23, 42, 0.85) !important; border-bottom-color: rgba(51, 65, 85, 0.5) !important; }
.dark .fn-sidebar { background: #1e293b !important; border-right-color: rgba(51, 65, 85, 0.5) !important; }
.dark .fn-topnav-link { color: #94a3b8 !important; }
.dark .fn-topnav-link:hover { color: #60a5fa !important; }
.dark .fn-topnav-link.active { color: #60a5fa !important; border-bottom-color: #60a5fa !important; }
.dark .fn-sidebar-link { color: #94a3b8 !important; }
.dark .fn-sidebar-link:hover { background: rgba(30, 41, 59, 0.8) !important; color: #60a5fa !important; }
.dark .fn-sidebar-link.active { background: rgba(0, 71, 212, 0.15) !important; color: #60a5fa !important; }

/* --- Search --- */
.dark .fn-topnav-search { background: #334155 !important; }
.dark .fn-topnav-search input { color: #f1f5f9 !important; }
.dark .fn-topnav-search input::placeholder { color: #64748b !important; }
.dark .fn-topnav-search .kbd { background: #475569 !important; color: #94a3b8 !important; }

/* --- Components --- */
.dark .fn-card { background: #1e293b !important; box-shadow: 0 0 0 1px rgba(51, 65, 85, 0.5) !important; }
.dark .fn-footer { background: #1e293b !important; border-top-color: rgba(51, 65, 85, 0.5) !important; }
.dark .fn-footer p { color: #94a3b8 !important; }
.dark .fn-theme-btn { color: #94a3b8; }
.dark .fn-theme-btn:hover { background: rgba(30, 41, 59, 0.8); color: #f1f5f9; }
.dark .fn-topnav-avatar img { border-color: rgba(51, 65, 85, 0.5) !important; }
.dark .fn-topnav-dot { border-color: #1e293b !important; }

/* --- Colors --- */
.dark .text-on-surface { color: #f1f5f9 !important; }
.dark .text-on-surface-variant { color: #94a3b8 !important; }
.dark .text-black { color: #f1f5f9 !important; }
.dark .text-gray { color: #94a3b8 !important; }

/* --- Backgrounds --- */
.dark .bg-white { background: #1e293b !important; }
.dark .bg-surface { background-color: #0f172a !important; }
.dark .bg-background { background-color: #0f172a !important; }
.dark .bg-surface-container-lowest { background: #1e293b !important; }
.dark .bg-surface-container-low { background: #1e293b !important; }
.dark .bg-surface-container { background: #334155 !important; }
.dark .bg-surface-container-high { background: #334155 !important; }
.dark .bg-surface-container-highest { background: #334155 !important; }

/* --- Hero --- */
.dark .hero-gradient { background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%) !important; }

/* --- Primary --- */
.dark .bg-primary\/5 { background: rgba(0, 71, 212, 0.15) !important; }
.dark .bg-primary\/10 { background: rgba(0, 71, 212, 0.2) !important; }
.dark .border-primary\/10 { border-color: rgba(0, 71, 212, 0.2) !important; }

/* --- Status Colors --- */
.dark .bg-green-50 { background: rgba(16, 185, 129, 0.1) !important; }
.dark .border-green-100 { border-color: rgba(16, 185, 129, 0.2) !important; }
.dark .bg-red-50 { background: rgba(239, 68, 68, 0.1) !important; }
.dark .border-red-100 { border-color: rgba(239, 68, 68, 0.2) !important; }

/* --- Border --- */
.dark .border-outline-variant\/20,
.dark .border-outline-variant\/30,
.dark .border-outline-variant\/50 { border-color: rgba(51, 65, 85, 0.5) !important; }

/* --- Shadows --- */
.dark .shadow-card, .dark .shadow-sm, .dark .shadow-subtle,
.dark .shadow-2xl, .dark .shadow-xl { box-shadow: 0 0 0 1px rgba(51, 65, 85, 0.5) !important; }

/* --- Buttons --- */
.dark .fn-btn-outline {
    background: #1e293b !important;
    border-color: rgba(51, 65, 85, 0.5) !important;
    color: #e2e8f0 !important;
}
.dark .fn-btn-outline:hover { background: #334155 !important; }
.dark .fn-btn-primary { background: #0047d4 !important; color: #ffffff !important; }
.dark .bg-primary.text-white { background: #0047d4 !important; color: #ffffff !important; }

/* --- Form Elements --- */
.dark input, .dark input::placeholder { color: #94a3b8 !important; background: transparent !important; }
.dark textarea, .dark textarea::placeholder { color: #94a3b8 !important; }
.dark select { color: #f1f5f9 !important; background: #1e293b !important; }
.dark input:focus, .dark select:focus, .dark textarea:focus {
    border-color: #0047d4 !important;
    box-shadow: 0 0 0 3px rgba(0, 71, 212, 0.1) !important;
}

/* --- Links --- */
.dark a:not(.fn-btn-primary):not(.fn-btn-secondary):not(.fn-btn-outline) { color: #60a5fa !important; }
.dark a:hover:not(.fn-btn-primary):not(.fn-btn-secondary):not(.fn-btn-outline) { color: #93c5fd !important; }

/* --- HR --- */
.dark hr { border-color: rgba(51, 65, 85, 0.5) !important; }

/* --- SVG Icons --- */
.dark svg:not(.text-primary):not(.text-secondary):not(.text-error):not(.text-success):not(.text-warning) { color: #94a3b8 !important; }

/* --- Scrollbar --- */
.dark ::-webkit-scrollbar-thumb { background: #475569 !important; }
.dark ::-webkit-scrollbar-thumb:hover { background: #64748b !important; }

/* --- Hover States --- */
.dark .hover\:bg-slate-50:hover { background-color: #334155 !important; }

/* --- Progress Bars --- */
.dark .bg-gray-200 { background-color: #334155 !important; }

/* --- Glass & Frosted --- */
.dark .glass-card { background: rgba(15, 23, 42, 0.7) !important; }
.dark .glass-blur { background: rgba(15, 23, 42, 0.8) !important; }
.dark .glass-header { background: rgba(15, 23, 42, 0.8) !important; border-bottom-color: rgba(51, 65, 85, 0.5) !important; }
.dark .glass-card-05 { background: rgba(15, 23, 42, 0.8) !important; border-color: rgba(51, 65, 85, 0.3) !important; }

/* --- Mesh & Decorative --- */
.dark .mesh-grid {
    background-image:
        linear-gradient(to right, rgba(255,255,255,0.03) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255,255,255,0.03) 1px, transparent 1px) !important;
}
.dark .blur-gradient { background: radial-gradient(circle at 50% 50%, rgba(0, 71, 212, 0.08) 0%, transparent 70%) !important; }
.dark .bg-grid {
    background-image: radial-gradient(#334155 1px, transparent 1px) !important;
}

/* --- Page Header --- */
.dark .page-header h1 { color: #f1f5f9 !important; }
.dark .page-header .page-subtitle { color: #94a3b8 !important; }

/* --- Breadcrumbs --- */
.dark .fn-breadcrumb { color: #64748b !important; }
.dark .fn-breadcrumb a { color: #94a3b8 !important; }
.dark .fn-breadcrumb a:hover { color: #60a5fa !important; }
.dark .fn-breadcrumb .sep { color: #475569 !important; }
.dark .fn-breadcrumb .current { color: #e2e8f0 !important; }

/* --- Page Title --- */
.dark .fn-page-title { color: #f1f5f9 !important; }
.dark .fn-page-desc { color: #94a3b8 !important; }

/* --- Zebra Table --- */
.dark .zebra-table tr:nth-child(even) { background-color: rgba(30, 41, 59, 0.5) !important; }
.dark .zebra-table tr:hover { background-color: rgba(51, 65, 85, 0.5) !important; }

/* --- Cost Table --- */
.cost-table { width: 100%; font-size: 0.875rem; border-collapse: collapse; }
.cost-table thead th {
    padding: 0.75rem 1rem; text-align: left;
    font-size: 0.75rem; font-weight: 600; color: #64748b;
    text-transform: uppercase; letter-spacing: 0.05em;
    background: #f8f9ff; border-bottom: 1px solid #e2e8f0;
}
.cost-table tbody td {
    padding: 0.75rem 1rem; border-bottom: 1px solid #e2e8f0;
    color: #051c33;
}
.cost-table tbody tr { transition: background-color 0.15s; }
.cost-table tbody tr:hover { background: #f1f5f9; }
.cost-table tbody tr:last-child td { border-bottom: none; }

.cost-table-card .fn-card-body { padding: 0; }
.cost-table-card .cost-table thead th:first-child { padding-left: 1.25rem; }
.cost-table-card .cost-table thead th:last-child { padding-right: 1.25rem; }
.cost-table-card .cost-table tbody td:first-child { padding-left: 1.25rem; }
.cost-table-card .cost-table tbody td:last-child { padding-right: 1.25rem; }

.dark .cost-table thead th {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border-bottom-color: rgba(51, 65, 85, 0.5) !important;
}
.dark .cost-table tbody td {
    color: #e2e8f0 !important;
    border-bottom-color: rgba(51, 65, 85, 0.3) !important;
}
.dark .cost-table tbody tr:hover { background: rgba(30, 41, 59, 0.8) !important; }
.dark .cost-table tr.bg-primary\/5 {
    background: rgba(0, 71, 212, 0.15) !important;
}

/* --- Gradient Overlays --- */
.dark .bg-gradient-to-t.from-black\/90 { --tw-gradient-from: rgba(0,0,0,0.95) !important; }
.dark .bg-gradient-to-t.from-slate-900 { --tw-gradient-from: rgba(15,23,42,0.95) !important; }

/* --- Specific --- */
.dark .bg-\[\#0a1b33\] { background: #0a1b33 !important; }
.dark .bg-\[\#fdfdfd\] { background-color: #1e293b !important; }
.dark .bg-white\/5 { background: rgba(255,255,255,0.05) !important; }
.dark .bg-surface\/80 { background: rgba(15, 23, 42, 0.85) !important; }

/* ============================================================
   Responsive Overrides
   ============================================================ */
@media (max-width: 1024px) {
    .px-margin-desktop { padding-left: 2rem; padding-right: 2rem; }
}
@media (max-width: 767px) {
    .px-margin-desktop { padding-left: 1rem; padding-right: 1rem; }
    .gap-gutter { gap: 1rem; }
}