/* Global Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary-color: #6366f1;
    /* Indigo */
    --primary-hover: #4f46e5;
    --secondary-color: #3b82f6;
    /* Blue */
    --accent-color: #f59e0b;
    /* Amber */
    --text-color: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --bg-color: #f8fafc;
    /* Slate 50 */
    --sidebar-bg: #0f172a;
    /* Slate 900 */
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --card-bg: #ffffff;
    --border-radius: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 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);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.3);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    height: 100vh;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    color: white;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.sidebar-header {
    padding: 16px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i,
.logo img {
    color: var(--primary-color);
    height: 32px;
    width: auto;
    object-fit: contain;
}

.sidebar-nav-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
    margin-bottom: 20px;
}

/* Custom Scrollbar for Sidebar */
.sidebar-nav-container::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav-container::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-links li {
    margin-bottom: 4px;
}

.nav-links a {
    text-decoration: none;
    color: rgba(255, 255, 255, 0.6);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links a:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
}

.nav-links a.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-links li {
    margin-bottom: 4px;
    position: relative;
}

.sub-nav {
    list-style: none;
    padding-left: 32px;
    margin-top: 4px;
}

.sub-nav li {
    margin-bottom: 2px;
}

.sub-nav a {
    padding: 6px 12px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.sub-nav a:hover {
    color: #fff;
}

.sub-nav a.active {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--primary-color);
    box-shadow: none;
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: var(--bg-color);
}

header {
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.025em;
}

/* Cards & Dashboard */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid rgba(0, 0, 0, 0.05);
    background: var(--card-bg);
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.metric-card h3 {
    margin: 0 0 8px 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-card .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-color);
    margin: 0;
}

.metric-card .value.expense {
    color: #ef4444;
}

.metric-card .value.income {
    color: #10b981;
}

.card {
    background: var(--card-bg);
    padding: 16px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(8px);
}

.card h3 {
    margin-top: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 12px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 16px;
    margin-top: 24px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Chart Controls */
.chart-toggles {
    display: flex;
    gap: 5px;
    background: #f1f1f1;
    padding: 3px;
    border-radius: 8px;
}

.btn-chart-type {
    border: none;
    background: transparent;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.btn-chart-type:hover {
    background: rgba(0, 0, 0, 0.05);
}

.btn-chart-type.active {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: var(--primary-color);
}

/* Forms */
.form-container {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    box-sizing: border-box;
    transition: all 0.2s;
    background-color: #fff;
    color: var(--text-color);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.radio-group label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
    color: #555;
}

.radio-group input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

button.btn-primary {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    min-width: 120px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

button.btn-primary:active {
    transform: translateY(0);
}

button.btn-secondary {
    background-color: #f1f5f9;
    color: var(--text-color);
    border: 1px solid #e2e8f0;
    padding: 10px 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    min-width: 120px;
    transition: all 0.2s;
}

button.btn-secondary:hover {
    background-color: #e2e8f0;
    color: var(--text-color);
}

/* Tables */
.table-container {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

th {
    background-color: #f8fafc;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

tr:hover td {
    background-color: #fcfcfc;
}

/* Section Visibility */
.section {
    display: none;
}

.section.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* Modal Overlay & Animations */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Semi-transparent black */
    backdrop-filter: blur(4px);
    /* Glassmorphism effect */
    z-index: 1000;
    display: none;
    /* Managed by JS */
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay .card {
    /* width managed inline or max-width here */
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(0);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- LOGIN PAGE --- */
.login-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #6366f1 0%, #4338ca 100%);
    animation: fadeIn 0.5s ease-out;
}

.login-card {
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding: 48px;
    max-width: 440px;
    width: 90%;
    animation: slideUp 0.5s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    margin: 16px 0 8px 0;
    font-size: 2rem;
    color: var(--text-color);
}

.login-header p {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.login-footer p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.login-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* Custom Select Wrapper for Sidebar */
.custom-select-wrapper {
    position: relative;
    user-select: none;
}

.company-select {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px;
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    appearance: none;
    -webkit-appearance: none;
    transition: all 0.2s;
}

.company-select:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
}

/* Fix for visibility of options in dropdown */
.company-select option {
    background-color: #ffffff;
    /* Light background for the dropdown list */
    color: #1e293b !important;
    /* Dark text for the items */
    padding: 10px;
}

.custom-select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right .7em top 50%;
    background-size: .65em auto;
    padding-right: 2.5em;
    /* Space for arrow */
}

/* Utilities */
.btn-sm {
    padding: 5px 12px;
    font-size: 0.85rem;
    margin-right: 5px;
    background: #eee;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-sm:hover {
    background: #e0e0e0;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    border: 1px solid transparent;
    background: none;
    cursor: pointer;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Report Specific Styles */
.report-table {
    width: 100%;
    margin-bottom: 0;
}

.report-table th,
.report-table td {
    padding: 10px 15px;
}

.report-subtotal {
    background-color: #fcfcfc;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.report-total {
    background-color: #f5f5f5;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--text-color);
    border-top: 2px solid #ddd;
}

.report-total td {
    border-bottom: none;
}

/* --- SPLIT VIEW LAYOUT --- */
.split-view-container {
    display: flex;
    gap: 0;
    position: relative;
    overflow: hidden;
    width: 100%;
    align-items: stretch;
}

.split-view-left {
    flex: 1;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid transparent;
}

.split-view-right {
    width: 0;
    overflow-y: auto;
    background: white;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    transform: translateX(20px);
    display: block !important;
    /* Always block, but width 0 */
}

/* Active State: When details are shown */
.split-view-container.active-details .split-view-left {
    flex: 0 0 350px;
    /* Fixed width for list in split mode */
    border-right: 1px solid #e2e8f0;
}

.split-view-container.active-details .split-view-right {
    flex: 1;
    width: auto;
    opacity: 1;
    transform: translateX(0);
    padding: 20px;
}

/* Balance Sheet Specific: Always 50/50 split */
#bs-container .split-view-container {
    gap: 20px;
}

#bs-container .split-view-left,
#bs-container .split-view-right {
    flex: 1 1 50% !important;
    width: 50% !important;
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    padding: 0 !important;
}

/* Badges for status */
.badge {
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge.paid {
    background: #dcfce7;
    color: #166534;
}

.badge.unpaid {
    background: #fef3c7;
    color: #92400e;
}

.badge.overdue {
    background: #fee2e2;
    color: #991b1b;
}

/* Status Selector Styles */
.status-select {
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.status-select.unpaid {
    color: #ef6c00;
    border-color: #ef6c00;
    background: #fff3e0;
}

.status-select.paid {
    color: #2e7d32;
    border-color: #2e7d32;
    background: #e8f5e9;
}

.status-select.overdue {
    color: #c62828;
    border-color: #c62828;
    background: #ffebee;
}

.status-select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.05);
}

.radio-group label {
    display: inline-block;
    margin-right: 15px;
    font-weight: normal;
    cursor: pointer;
}

/* Styled Date Pickers */
.date-input-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.date-input-wrapper i {
    position: absolute;
    left: 10px;
    color: var(--primary-color);
    pointer-events: none;
    font-size: 0.9rem;
    z-index: 1;
}

input[type="date"].styled-date {
    padding: 8px 12px 8px 32px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-color);
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    outline: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

input[type="date"].styled-date:hover {
    border-color: var(--primary-color);
    background-color: #fcfcfc;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

input[type="date"].styled-date:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
    background-color: #fff;
}

/* Hide default calendar icon but keep it clickable in some browsers */
input[type="date"].styled-date::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
}

input[type="date"].styled-date::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* --- PREMIUM PAGINATION --- */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 12px 20px;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.pagination-controls .page-info {
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.5px;
}

.pagination-group {
    display: flex;
    gap: 10px;
}

.pagination-controls button {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination-controls button:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.pagination-controls button:active:not(:disabled) {
    transform: translateY(0);
}

.pagination-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8f9fa;
    border-color: #eee;
}

/* --- ACTION BUTTONS --- */
.btn-delete {
    background: #fff5f5;
    color: #e53e3e;
    border: 1px solid #fed7d7;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    margin-left: 5px;
}

.btn-delete:hover {
    background: #e53e3e;
    color: white;
    border-color: #e53e3e;
}

/* --- MODAL OVERLAY --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    text-align: center;
}

.delete-modal .modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #e53e3e;
}

.delete-modal h3 {
    margin: 0 0 12px 0;
    font-size: 1.5rem;
    color: #2d3748;
}

.delete-modal p {
    margin: 0 0 24px 0;
    color: #718096;
    font-size: 0.95rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-actions button {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    min-width: 100px;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.settings-tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.settings-tab-btn:hover {
    background: #f8fafc;
    color: #4a5568;
}

.settings-tab-btn.active {
    background: #ebf8ff;
    color: #3182ce;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    letter-spacing: 0.5px;
}

.pagination-group {
    display: flex;
    gap: 10px;
}

.pagination-controls button {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination-controls button:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.pagination-controls button:active:not(:disabled) {
    transform: translateY(0);
}

.pagination-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f8f9fa;
    border-color: #eee;
}

/* --- ACTION BUTTONS --- */
.btn-delete {
    background: #fff5f5;
    color: #e53e3e;
    border: 1px solid #fed7d7;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    margin-left: 5px;
}

.btn-delete:hover {
    background: #e53e3e;
    color: white;
    border-color: #e53e3e;
}

/* --- MODAL OVERLAY --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
    text-align: center;
}

.delete-modal .modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #e53e3e;
}

.delete-modal h3 {
    margin: 0 0 12px 0;
    font-size: 1.5rem;
    color: #2d3748;
}

.delete-modal p {
    margin: 0 0 24px 0;
    color: #718096;
    font-size: 0.95rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-actions button {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    min-width: 100px;
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.settings-tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.settings-tab-btn:hover {
    background: #f8fafc;
    color: #4a5568;
}

.settings-tab-btn.active {
    background: #ebf8ff;
    color: #3182ce;
}

/* Visibility Utility */
/* Visibility Utility - Controlled by JS */


@media (max-width: 1024px) {
    .split-view-container.active-details .split-view-left {
        display: none;
        /* On tablet/mobile, hide list when details correspond */
    }
}

/* --- MODERN SEARCH BAR UI --- */
.search-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    display: flex;
    align-items: center;
}

.search-container i {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    z-index: 10;
    pointer-events: none;
    /* Colorful Icon Effect */
    background: linear-gradient(135deg, #4fcdf5 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    /* Standard property for compatibility */
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 50px !important;
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 50px !important;
    /* Pill Shape */
    color: var(--text-color) !important;
    font-size: 0.95rem !important;
    font-weight: 500 !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02) !important;
    margin: 0 !important;
}

.search-input:focus {
    outline: none !important;
    border-color: #cbd5e1 !important;
    box-shadow: 0 0 0 4px rgba(79, 205, 245, 0.1), 0 4px 6px -1px rgb(0 0 0 / 0.1) !important;
    transform: translateY(-1px) !important;
}

.search-input::placeholder {
    color: #94a3b8 !important;
    opacity: 0.8 !important;
}

/* --- ITEMS SPLIT VIEW REDESIGN --- */

/* Compact List View (Active when details are shown) */
.active-details #items-list-pane {
    max-width: 350px;
    border-right: 1px solid #e2e8f0;
}

.compact-item-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.compact-item-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.2s;
}

.compact-item-row:hover {
    background: #f8fafc;
}

.compact-item-row.selected {
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
}

.compact-item-info {
    flex: 1;
    margin-left: 12px;
}

.compact-item-name {
    font-weight: 500;
    color: #1e293b;
    font-size: 0.95rem;
    display: block;
}

.compact-item-rate {
    font-size: 0.85rem;
    color: #64748b;
}

/* Refined Details Pane */
#items-detail-pane {
    background: #f8fafc;
    padding: 0 !important;
}

.item-details-header {
    background: #fff;
    padding: 20px 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-details-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.item-details-tabs {
    background: #fff;
    padding: 0 30px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    gap: 30px;
}

.item-tab {
    padding: 15px 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.item-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.item-details-body {
    display: flex;
    padding: 30px;
    gap: 30px;
}

.item-main-content {
    flex: 1;
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.item-sidebar {
    width: 320px;
}

.item-info-section {
    margin-bottom: 40px;
}

.item-info-section h4 {
    font-size: 1.1rem;
    color: #1e293b;
    margin: 0 0 20px 0;
}

.item-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 15px 20px;
}

.item-grid-label {
    color: #94a3b8;
    font-size: 0.9rem;
}

.item-grid-value {
    color: #1e293b;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Sidebar Summary Cards */
.summary-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.summary-card-item {
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px dashed #e2e8f0;
}

.summary-card-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.summary-label {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
}

.summary-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.small-summary-box {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.small-summary-box .val {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.small-summary-box .lbl {
    font-size: 0.75rem;
    color: #64748b;
}

/* --- PREVIEW MODAL --- */
.preview-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.preview-modal-content {
    background: #1e1e1e;
    /* Dark theme frame */
    width: 90%;
    height: 90vh;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.preview-header {
    padding: 15px 20px;
    background: #252526;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}

.preview-title {
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-badge {
    background: #6366f1;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.preview-close-btn {
    background: transparent;
    border: none;
    color: #aaa;
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.preview-close-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.preview-iframe-container {
    flex: 1;
    background: white;
    position: relative;
    overflow: hidden;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* --- PREVIEW MODE OVERRIDES --- */
/* These rules ensure the app layout inside the iframe behaves for previews */
/* Preview Mode Layout Reset */
body.preview-active {
    display: block !important;
    height: auto !important;
    min-height: 100vh;
    overflow: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--bg-color) !important;
}

body.preview-active .sidebar {
    display: none !important;
}

body.preview-active #main-app {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.preview-active .main-content {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    padding: 20px !important;
    display: block !important;
}

body.preview-active header {
    text-align: center !important;
    margin-bottom: 20px !important;
}

body.preview-active #page-title {
    display: inline-block !important;
}

/* Simulated Cursor for Previews */
.sim-cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z'%3E%3C/path%3E%3C/svg%3E");
    background-size: cover;
    pointer-events: none;
    z-index: 9999;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.3));
    z-index: 10000;
}

.sim-click-effect {
    position: fixed;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(99, 102, 241, 0.8);
    background: rgba(99, 102, 241, 0.2);
    pointer-events: none;
    z-index: 9998;
    animation: ping 0.5s cubic-bezier(0, 0, 0.2, 1) forwards;
}

@keyframes ping {

    75%,
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* ==================== LANDING PAGE LIGHT MODE ==================== */

/* Landing Page Container - Light Background */
.landing-container {
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 50%, #dbeafe 100%);
    min-height: 100vh;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.landing-container::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(199, 210, 254, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
}

/* Landing Header - Light Mode */
.landing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 60px;
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.landing-header .logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.landing-header .logo i {
    color: var(--primary-color);
}

.landing-nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Hero Section - Light Mode */
.hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 40px;
    padding: 80px 20px;
    position: relative;
    z-index: 1;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 900;
    line-height: 1.1;
    margin: 0 0 24px 0;
    color: #0f172a;
    letter-spacing: -0.02em;
}

.text-gradient {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-content p {
    font-size: 1.25rem;
    line-height: 1.7;
    color: #475569;
    margin: 0 auto 32px;
    max-width: 640px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* Glass Card in Hero - Light Mode */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(99, 102, 241, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.6);
}

.mockup {
    max-width: 500px;
    margin: 0 auto;
}

.mockup-header {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.6);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

.dot.yellow {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.dot.green {
    background: linear-gradient(135deg, #34d399, #10b981);
}

.mockup-body {
    padding: 16px 0;
}

.mockup-line {
    height: 12px;
    background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
    border-radius: 6px;
    margin-bottom: 12px;
}

.mockup-line.long {
    width: 80%;
}

.mockup-line.med {
    width: 60%;
}

.mockup-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.mockup-item {
    height: 60px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 8px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Features Section - Light Mode */
.features-header {
    text-align: center;
    padding: 40px 60px 20px;
    position: relative;
    z-index: 1;
}

.features-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px 0;
    letter-spacing: -0.02em;
}

.features-header p {
    font-size: 1.125rem;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto;
}

.features-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    padding: 20px 60px 80px;
    position: relative;
    z-index: 1;
}

.feature-card {
    background: rgba(255, 255, 255, 0.9);
    padding: 32px 24px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.08);
    border: 1px solid rgba(226, 232, 240, 0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #ec4899);
    transform: translateX(-100%);
    transition: transform 0.4s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
}

.feature-card:hover::before {
    transform: translateX(0);
}

.feature-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 16px;
    display: block;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 12px 0;
}

.feature-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #64748b;
    margin: 0 0 20px 0;
}

.preview-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
}

.preview-link i {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    margin: 0 !important;
}

.preview-link:hover {
    color: var(--primary-hover);
    gap: 12px;
}

.preview-link:hover i {
    transform: translateX(4px);
}

.icon-container {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 1.5rem;
}

.landing-footer {
    text-align: center;
    padding: 24px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    color: #64748b;
    font-size: 0.9rem;
    position: relative;
    z-index: 10;
}

.landing-footer p {
    margin: 0;
}

/* Button Overrides - Light Mode */
.landing-container .btn-text {
    background: transparent;
    color: #475569;
    border: none;
    padding: 10px 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 8px;
}

.landing-container .btn-text:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.landing-container .btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.landing-container .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.4);
}

.landing-container .btn-primary.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.landing-container .btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: #475569;
    border: 2px solid rgba(226, 232, 240, 0.8);
    padding: 12px 24px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.landing-container .btn-secondary:hover {
    background: white;
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.15);
}

.landing-container .btn-secondary.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.login-container {
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 50%, #dbeafe 100%);
    min-height: 100vh;
    width: 100%;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 48px;
    box-shadow: 0 20px 50px rgba(99, 102, 241, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.6);
    width: 100%;
    max-width: 440px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    color: #1e293b;
    margin: 16px 0 8px;
    font-size: 2rem;
}

.login-header p {
    color: #64748b;
    margin: 0;
    font-size: 1rem;
}