/* LuneBooks Modern Theme */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #eef2ff;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1e293b;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --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);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* {
    box-sizing: border-box;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f1f5f9;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

h1 { font-size: 1.875rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--dark-color) 0%, #334155 100%) !important;
    box-shadow: var(--shadow-md);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}



.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    margin-top: 0.5rem;
}

.dropdown-item {
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.dropdown-item:hover {
    background-color: var(--primary-light);
    color: var(--primary-color);
}

.dropdown-item.active {
    background-color: var(--primary-color);
    color: white;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: white;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

.card-title {
    font-weight: 600;
    color: var(--dark-color);
}

/* Buttons */
.btn {
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #818cf8 100%);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary-color) 100%);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

.btn-outline-secondary {
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background-color: var(--light-color);
    border-color: var(--secondary-color);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #34d399 100%);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #f87171 100%);
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

/* Forms */
.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    transition: all 0.2s ease;
    font-size: 0.9375rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.input-group-text {
    background-color: var(--light-color);
    border: 2px solid var(--border-color);
    border-right: none;
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: linear-gradient(135deg, var(--dark-color) 0%, #334155 100%);
    color: white;
    font-weight: 600;
    padding: 0.675rem 0.5rem;;
    border: none;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table thead th:first-child {
    border-top-left-radius: var(--radius);
}

.table thead th:last-child {
    border-top-right-radius: var(--radius);
}

.table tbody td {
    padding: 0.675rem 0.5rem;;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table-hover tbody tr:hover td {
    background-color: #ecf4ff !important;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(248, 250, 252, 0.5);
}

.table-striped.table-hover tbody tr:nth-of-type(odd):hover td {
    background-color: #ecf4ff !important;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.75em;
    border-radius: var(--radius);
}

.bg-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #34d399 100%) !important;
}

.bg-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #f87171 100%) !important;
}

.bg-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #fbbf24 100%) !important;
    color: var(--dark-color) !important;
}

.bg-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #60a5fa 100%) !important;
}

.bg-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, #818cf8 100%) !important;
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    font-weight: 500;
}

.alert-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
}

.alert-success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    color: #065f46;
}

.alert-warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    color: #92400e;
}

.alert-danger {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #991b1b;
}

/* Page Container */
.container {
    max-width: 1280px;
}

main {
    padding-bottom: 2rem;
}

/* Dashboard Stats Cards */
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: all 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Footer */
footer {
    background: white;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Custom Checkbox Styling */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Transitions */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Login Page Styles */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
}

.login-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #818cf8 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.login-logo svg {
    width: 36px;
    height: 36px;
    color: white;
}

.login-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.login-card .form-control {
    padding: 0.75rem 1rem;
}

.login-card .btn-primary {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Profile Selector */
.profile-selector .dropdown-toggle::after {
    margin-left: 0.5rem;
}

.profile-selector .dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* Import Preview Page */
.import-preview-table .form-select-sm {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
}

.selection-counter {
    font-weight: 600;
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    border-radius: var(--radius);
    color: var(--primary-color);
    display: inline-block;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-brand::before {
        width: 28px;
        height: 28px;
    }

    h1 { font-size: 1.5rem; }

    .card-body {
        padding: 1rem;
    }

    .table-responsive {
        border-radius: var(--radius-lg);
    }
}

/* Utility Classes */
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-light { background-color: var(--light-color) !important; }
.border { border-color: var(--border-color) !important; }

.rounded-lg { border-radius: var(--radius-lg) !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow) !important; }
.shadow-md { box-shadow: var(--shadow-md) !important; }

/* Highlight the transaction that was just edited (overrides striped/hover row backgrounds) */
.table > tbody > tr.row-edited > * {
    --bs-table-bg-state: #fff3cd;
}
.table > tbody > tr.row-edited > td:first-child {
    border-left: 4px solid #f59e0b;
}
.table > tbody > tr.row-edited {
    animation: row-edited-pulse 1.2s ease-out 1;
}
@keyframes row-edited-pulse {
    0%   { filter: brightness(0.9); }
    100% { filter: none; }
}
