/* Soft Rose & Sage Color Scheme - CSS for Vue App */
/* Warm blush pink, cream, and sage green tones */

:root {
    /* Primary Colors - Sage Green */
    --primary-color: #b0c4b1;          /* Sage Green */
    --primary-hover: #9ab39b;          /* Darker Sage */
    --primary-dark: #7a9a7c;           /* Deep Sage */
    
    /* Accent Colors - Rose Pink */
    --accent-color: #edafb8;           /* Rose Pink */
    --accent-hover: #e09aa5;           /* Darker Rose */
    
    /* Secondary Colors - Charcoal */
    --secondary-color: #4a5759;        /* Dark Charcoal */
    --secondary-hover: #3a4547;        /* Darker Charcoal */
    
    /* Status Colors */
    --success-color: #7cb07e;          /* Soft Green */
    --success-hover: #5f9a61;
    --danger-color: #d9534f;           /* Soft Red */
    --danger-hover: #c9302c;
    --warning-color: #e8b758;          /* Soft Amber */
    
    /* Backgrounds - Cream/Beige palette */
    --background: #f7e1d7;             /* Warm Cream */
    --surface: #FFFFFF;                /* White */
    --surface-alt: #dedbd2;            /* Light Taupe */
    
    /* Text Colors */
    --text-primary: #4a5759;           /* Dark Charcoal */
    --text-secondary: #5e6b6d;         /* Medium Charcoal */
    --text-muted: #7a8587;             /* Muted Gray */
    
    /* Border & Shadows */
    --border-color: #dedbd2;           /* Light Taupe Border */
    --shadow: 0 2px 4px rgba(74, 87, 89, 0.10);
    --shadow-md: 0 4px 12px rgba(74, 87, 89, 0.14);
    --shadow-lg: 0 8px 24px rgba(74, 87, 89, 0.18);
    
    /* Layout */
    --radius: 8px;
    --radius-lg: 12px;
}

/* Base Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Hide page until color scheme is loaded to prevent flash */
body {
    opacity: 0;
    transition: opacity 0.15s ease-in;
}

body.color-loaded,
html.color-preloaded body {
    opacity: 1;
}

body {
    font-family: 'Segoe UI', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ==================== HEADER ==================== */
.header {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: white;
    padding: 24px 0;
    box-shadow: var(--shadow-md);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.25);
    padding: 8px;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
    .header-brand {
        flex-direction: column;
        text-align: center;
    }

    .header-logo {
        width: 56px;
        height: 56px;
        padding: 6px;
    }

    .header h1 {
        font-size: 1.5rem;
    }
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.header h1 [class*="icon-"] {
    font-size: 1.6rem;
}

/* ==================== NAVIGATION ==================== */
.nav {
    background: var(--surface);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 4px;
    padding: 12px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: all 0.25s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-link:hover {
    background: var(--surface-alt);
    color: var(--accent-color);
}

.nav-link.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 8px rgba(237, 175, 184, 0.4);
}

/* ==================== MAIN CONTENT ==================== */
.main {
    padding: 32px 0;
    min-height: calc(100vh - 200px);
}

.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active,
.section[style*="display: block"],
section:not([style*="display: none"]) {
    display: block;
}

/* Vue v-show compatibility */
[v-cloak] { display: none; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section h2 {
    margin-bottom: 24px;
    color: var(--text-primary);
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ==================== DASHBOARD CARDS ==================== */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: box-shadow 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--surface-alt);
    font-weight: 600;
}

.card-content {
    display: flex;
    justify-content: space-around;
}

.stat {
    text-align: center;
    padding: 8px;
}

.stat-value {
    display: block;
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Monthly Table Container */
.monthly-table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.monthly-table-container h3 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

/* ==================== TABLES ==================== */
.table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow-x: auto;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--surface-alt);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(176, 196, 177, 0.08);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 12px;
}

.table-pagination span {
    color: var(--text-secondary);
    font-weight: 600;
}

.table-pagination .btn {
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

@media (max-width: 768px) {
    .table-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .table-pagination .btn {
        width: 100%;
    }
}

/* ==================== FORMS ==================== */
.form {
    background: var(--surface);
    padding: 28px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 11px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    background: var(--surface);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(237, 175, 184, 0.2);
}

.form-group input[readonly] {
    background: var(--surface-alt);
    color: var(--text-secondary);
}

/* ==================== CURRENCY INPUT ==================== */
.currency-input {
    display: flex;
    align-items: stretch;
}

.currency-prefix {
    display: flex;
    align-items: center;
    padding: 0 14px;
    background: var(--surface-alt);
    border: 2px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.currency-input input {
    flex: 1;
    padding: 11px 14px;
    border: 2px solid var(--border-color);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 1rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    background: var(--surface);
    min-width: 0;
}

.currency-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(237, 175, 184, 0.2);
}

.currency-input input:focus + .currency-prefix,
.currency-input:focus-within .currency-prefix {
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--surface-alt);
}

/* ==================== SEARCHABLE SELECT ==================== */
.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select input {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    background: var(--surface);
}

.searchable-select input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(237, 175, 184, 0.2);
}

.searchable-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 250px;
    overflow-y: auto;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.searchable-select-option {
    padding: 12px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid var(--border-color);
}

.searchable-select-option:last-child {
    border-bottom: none;
}

.searchable-select-option:hover {
    background: var(--surface-alt);
    color: var(--accent-color);
}

.searchable-select-empty {
    padding: 12px 14px;
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* ==================== ICONS ==================== */
[class*="icon-"] {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.btn-sm [class*="icon-"] {
    font-size: 15px;
}

.header-icon {
    font-size: 28px;
    margin-right: 8px;
}

.nav-link [class*="icon-"] {
    font-size: 18px;
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 8px rgba(237, 175, 184, 0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(237, 175, 184, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: var(--success-hover);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--surface-alt);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.85rem;
}

/* ==================== SECTION ACTIONS ==================== */
.section-actions {
    margin-bottom: 24px;
}

/* ==================== SEARCH BAR ==================== */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-bar input {
    padding: 11px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    min-width: 220px;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(237, 175, 184, 0.2);
}

.search-bar .search-input-animated {
    flex: 1;
    min-width: 280px;
}

.search-bar .search-input-animated input {
    width: 100%;
}

/* ==================== REPORT FILTERS ==================== */
.report-filters {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: flex-end;
    background: var(--surface);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.report-filters .form-group {
    margin-bottom: 0;
}

/* ==================== REPORT SUMMARY ==================== */
.report-summary {
    display: flex;
    gap: 32px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-hover) 100%);
    color: white;
    padding: 24px 28px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: 0 4px 16px rgba(237, 175, 184, 0.35);
}

.summary-item {
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.summary-value {
    font-size: 1.6rem;
    font-weight: 700;
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(61, 61, 61, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: scale(0.95) translateY(-20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-content.modal-large {
    max-width: 900px;
}

.modal-content.modal-sm {
    max-width: 450px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid var(--surface-alt);
    background: var(--surface-alt);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    font-weight: 600;
}

.modal-close {
    background: var(--surface);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--danger-color);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal .form {
    box-shadow: none;
    border: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ==================== TOAST NOTIFICATION ==================== */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text-primary);
    color: white;
    padding: 16px 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.35s ease;
    z-index: 2000;
    font-weight: 500;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

/* ==================== ACTION BUTTONS IN TABLE ==================== */
.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

/* ==================== FOOTER ==================== */
.footer {
    background: var(--surface);
    border-top: 2px solid var(--border-color);
    padding: 24px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==================== SETTINGS PAGE ==================== */
.settings-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.settings-card h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--surface-alt);
    color: var(--accent-color);
    font-weight: 600;
}

.settings-card .form-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: 12px;
}

.settings-card .form-group {
    flex: 1;
    max-width: 300px;
}

.settings-card .help-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.settings-table-actions {
    margin-bottom: 16px;
}

.settings-card .data-table {
    margin-top: 12px;
}

.settings-card .data-table th,
.settings-card .data-table td {
    padding: 10px 14px;
}

.settings-field {
    display: none;
}

.settings-field.show {
    display: block;
}

/* ==================== COLOR SCHEME PICKER ==================== */
.color-scheme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.color-scheme-option {
    cursor: pointer;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--surface);
    transition: all 0.25s ease;
}

.color-scheme-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.color-scheme-option.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(237, 175, 184, 0.3);
}

.color-scheme-preview {
    display: flex;
    border-radius: var(--radius);
    overflow: hidden;
    height: 40px;
    margin-bottom: 10px;
}

.color-scheme-preview span {
    flex: 1;
}

.color-scheme-name {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.color-scheme-option {
    position: relative;
}

.color-scheme-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 4px 6px !important;
    font-size: 0.7rem !important;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.color-scheme-option:hover .color-scheme-delete {
    opacity: 1;
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* Color Picker for Add Scheme Modal */
.color-picker-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.color-picker-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.color-picker-item input[type="color"] {
    width: 50px;
    height: 50px;
    padding: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    background: transparent;
}

.color-picker-item input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-item input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.color-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

.color-scheme-preview-large {
    display: flex;
    border-radius: var(--radius);
    overflow: hidden;
    height: 60px;
}

.color-scheme-preview-large span {
    flex: 1;
}

/* ==================== UTILITY CLASSES ==================== */
.hidden {
    display: none !important;
}

/* ==================== SCROLLING PLACEHOLDER ==================== */
.search-input-animated {
    position: relative;
}

.search-input-animated input::placeholder {
    color: transparent;
}

.search-input-animated input:placeholder-shown + .placeholder-text {
    display: block;
}

.search-input-animated input:focus + .placeholder-text,
.search-input-animated input:not(:placeholder-shown) + .placeholder-text {
    display: none;
}

.placeholder-text {
    display: none;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #999;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    max-width: calc(100% - 24px);
}

.placeholder-text span {
    display: inline-block;
    animation: scrollPlaceholder 8s linear infinite;
    padding-right: 50px;
}

@keyframes scrollPlaceholder {
    0%, 10% {
        transform: translateX(0);
    }
    45%, 55% {
        transform: translateX(calc(-100% + 250px));
    }
    90%, 100% {
        transform: translateX(0);
    }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header h1 {
        font-size: 1.1rem;
    }
    
    .nav-list {
        flex-wrap: wrap;
        gap: 2px;
    }
    
    .nav-link {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .section h2 {
        font-size: 1.3rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-bar input {
        width: 100%;
        min-width: auto;
    }
    
    .report-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .report-summary {
        flex-direction: column;
        gap: 16px;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 10px 12px;
    }
    
    .action-buttons {
        flex-wrap: wrap;
    }
    
    .modal-content {
        margin: 10px;
    }
    
    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .header, .nav, .footer, .btn, .search-bar, .section-actions, .form-actions, .modal {
        display: none !important;
    }
    
    .section {
        display: block !important;
    }
    
    .main {
        padding: 0;
    }
    
    .card, .table-container, .settings-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
