/* Modern FINZA Design System */
:root {
    /* Core Colors - Dark Mode (Default) */
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #0f172a;
    --bg-header: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;

    /* Brand Colors */
    --primary: #f59e0b;
    /* Amber/Yellow */
    --primary-hover: #d97706;
    --primary-text: #1e293b;
    /* Dark text for contrast on yellow */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    /* Accents */
    --accent-glow: rgba(245, 158, 11, 0.15);

    /* Spacing & Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 15px var(--accent-glow);

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Mode Overrides */
[data-theme="light"] {
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;

    --accent-glow: rgba(59, 130, 246, 0.05);
}

/* Base Resets & Typography */
body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
    color: var(--primary);
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

/* Layout Components */
.content-wrapper {
    background-color: var(--bg-body);
    min-height: 100vh;
}

.main-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.main-sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
}

/* Cards */
.card,
.box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover,
.box:hover {
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.box-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.25rem;
    color: var(--text-primary);
}

.box-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.box-body {
    padding: 1.5rem;
    color: var(--text-secondary);
}

/* Forms */
.form-control {
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 0.625rem 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    background-color: var(--bg-body);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
    color: var(--text-primary);
}

/* Buttons */
.btn {
    border-radius: var(--radius-md);
    font-weight: 500;
    padding: 0.625rem 1.25rem;
    transition: all var(--transition-fast);
    text-transform: none;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--primary-text);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px var(--accent-glow);
    color: var(--primary-text);
}

/* Tables */
.table {
    color: var(--text-secondary);
}

.table thead th {
    background-color: var(--bg-body);
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    border-top: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table td,
.table th {
    border-top: 1px solid var(--border-color);
    vertical-align: middle;
    padding: 1rem;
}

.table-hover tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .table-hover tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Utilities */
.text-primary {
    color: var(--primary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.bg-card {
    background-color: var(--bg-card) !important;
}

.bg-body {
    background-color: var(--bg-body) !important;
}

.border-light {
    border-color: var(--border-color) !important;
}

/* Theme Toggle Switch */
.theme-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: var(--text-secondary);
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary);
    border-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(24px);
    background-color: white;
}

/* Sidebar Navigation */
.sidebar-menu>li>a {
    color: var(--text-secondary);
    border-left: 3px solid transparent;
    transition: all var(--transition-fast);
}

.sidebar-menu>li:hover>a,
.sidebar-menu>li.active>a {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
    border-left-color: var(--primary);
}

[data-theme="light"] .sidebar-menu>li:hover>a,
[data-theme="light"] .sidebar-menu>li.active>a {
    background-color: rgba(0, 0, 0, 0.05);
}

.sidebar-menu>li>.treeview-menu {
    background-color: rgba(0, 0, 0, 0.2);
}

[data-theme="light"] .sidebar-menu>li>.treeview-menu {
    background-color: rgba(0, 0, 0, 0.03);
}

/* Auth Pages (Login/Register) */
.auth-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
    margin: 0 auto;
}

.register-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.auth-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
}

.login-logo {
    margin-bottom: 2rem;
    text-align: center;
}

.login-logo img {
    max-height: 60px;
    width: auto;
}

.site-logo img {
    max-height: 50px;
    width: auto;
}

.auth-title,
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.auth-subtitle,
.page-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.form-control-feedback {
    line-height: 48px;
    height: 48px;
    color: var(--text-muted);
}

.btn-primary-auth {
    height: 48px;
    font-size: 1rem;
    font-weight: 600;
    width: 100%;
    margin-top: 1rem;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-footer a {
    font-weight: 600;
}

.forgot-link {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: inline-block;
}

.forgot-link:hover {
    color: var(--primary);
}

/* Progress Bar (Register) */
.progressbar {
    counter-reset: step;
    padding: 0;
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.progressbar li {
    list-style-type: none;
    width: 25%;
    float: left;
    font-size: 12px;
    position: relative;
    text-align: center;
    text-transform: uppercase;
    color: var(--text-muted);
}

.progressbar li:before {
    width: 30px;
    height: 30px;
    content: counter(step);
    counter-increment: step;
    line-height: 26px;
    border: 2px solid var(--border-color);
    display: block;
    text-align: center;
    margin: 0 auto 10px auto;
    border-radius: 50%;
    background-color: var(--bg-card);
    color: var(--text-muted);
    font-weight: 600;
}

.progressbar li:after {
    width: 100%;
    height: 2px;
    content: '';
    position: absolute;
    background-color: var(--border-color);
    top: 15px;
    left: -50%;
    z-index: -1;
}

.progressbar li:first-child:after {
    content: none;
}

.progressbar li.active {
    color: var(--primary);
}

.progressbar li.active:before {
    border-color: var(--primary);
    color: var(--primary);
    background-color: rgba(245, 158, 11, 0.1);
}

.progressbar li.active+li:after {
    background-color: var(--primary);
}

/* Pricing Table (Register) */
.pricing-table {
    background: transparent;
}

.pricing-table .header .title {
    color: var(--text-primary);
}

.pricing-table .price {
    color: var(--primary);
}

.pricing-table .price_year,
.pricing-table .price_month {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.5rem;
}

.pricing-table th,
.pricing-table td {
    border-color: var(--border-color) !important;
    color: var(--text-secondary);
}

.pricing-table .feature-item i.ico-checked {
    color: var(--success);
}

.pricing-table .feature-item i.ico-unchecked {
    color: var(--text-muted);
}

.btn-group-toggle .btn-outline-primary {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-group-toggle .btn-outline-primary:hover,
.btn-group-toggle .btn-outline-primary.active {
    background-color: var(--primary);
    color: var(--primary-text);
    border-color: var(--primary);
}

.custom-btn {
    background-color: var(--primary);
    color: var(--primary-text);
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    display: inline-block;
}

.custom-btn:hover {
    background-color: var(--primary-hover);
    color: var(--primary-text);
    text-decoration: none;
}

.icon-box {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

/* --- FIXES & OVERRIDES --- */

/* Fix Login Logo Size */
.login-logo img {
    height: 60px !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain;
}

/* Fix Sidebar/Header Logo Background */
.main-header .logo {
    background-color: var(--bg-header) !important;
    color: var(--text-primary) !important;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.main-header .logo:hover {
    background-color: var(--bg-header) !important;
}

/* Fix Navbar Background */
.main-header,
.main-header .navbar,
.main-header .logo {
    background-color: var(--bg-header) !important;
}

/* Fix Sidebar Toggle Color */
.main-header .sidebar-toggle {
    color: var(--text-secondary) !important;
}

.main-header .sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-primary) !important;
}

/* Fix User Menu Text Color */
.navbar-custom-menu .nav-link,
.navbar-custom-menu .btn {
    color: var(--text-secondary) !important;
}

/* Ensure Body Background is Dark */
body.hold-transition {
    background-color: var(--bg-body) !important;
}

/* Fix Input Visibility on Dark Background */
input.form-control {
    background-color: var(--bg-body) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

input.form-control:focus {
    border-color: var(--primary) !important;
}