/* =====================================================
   SnapLedger - Modern Finance PWA Styles
   ===================================================== */

/* CSS Variables */
:root {
    --primary-color: #0F172A;
    --primary-dark: #071026;
    --secondary-color: #14B8A6;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --background: #F8FAFC;
    --surface: #FFFFFF;
    --text-primary: #0B1220;
    --text-secondary: #475569;
    --border-color: #E2E8F0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.install-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid white;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.install-btn:hover {
    background: white;
    color: var(--primary-color);
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: white;
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    position: sticky;
    top: 64px;
    z-index: 99;
}

.nav-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
    white-space: nowrap;
}

.nav-tab:hover {
    color: var(--primary-color);
    background: rgba(20, 184, 166, 0.05);
}

.nav-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card Component */
.card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.dashboard-grid > * {
    min-width: 0;
}

/* Summary Cards */
.summary-card {
    text-align: center;
}

.summary-card .amount {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.card-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.change-indicator {
    font-weight: 600;
    font-size: 0.9rem;
}

.change-indicator.positive {
    color: var(--secondary-color);
}

.change-indicator.negative {
    color: var(--danger-color);
}

.label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--primary-color));
    transition: width 0.3s ease;
}

/* Chart Cards */
.chart-card {
    grid-column: span 1;
}

.chart-card canvas {
    max-height: 300px;
}

/* Transaction List */
.transaction-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.transaction-item:hover {
    background: rgba(20, 184, 166, 0.05);
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-info {
    flex: 1;
}

.transaction-description {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.transaction-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.transaction-amount {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--danger-color);
}

.transaction-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

/* Form Styles */
.expense-form,
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
}

/* AI Suggestion */
.ai-suggestion {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: rgba(20, 184, 166, 0.08);
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-suggestion span {
    font-weight: 600;
    color: var(--secondary-color);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background: var(--text-primary);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #DC2626;
}

.btn-link {
    background: none;
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    text-decoration: underline;
}

.btn-icon {
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
}

.btn-icon:hover {
    transform: scale(1.2);
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input,
.filter-select {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Insights */
.insights-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.insight {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(79, 70, 229, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.insight-icon {
    font-size: 1.5rem;
}

.insight-content strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--primary-color);
}

/* Predictions */
.predictions-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.prediction-card {
    padding: 1rem;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 8px;
    text-align: center;
}

.prediction-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Data Actions */
.data-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    background: var(--text-primary);
    color: white;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    background: var(--secondary-color);
}

.toast.error {
    background: var(--danger-color);
}

/* Small Text */
.small-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Responsive Design */

/* Tablet - 2 columns */
@media (min-width: 640px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop - 3 columns */
@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile adjustments */
@media (max-width: 639px) {
    .main-content {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .filter-controls {
        flex-direction: column;
    }

    .nav-tab {
        font-size: 0.8rem;
        padding: 0.75rem;
    }

    .app-header h1 {
        font-size: 1.25rem;
    }

    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .transaction-actions {
        margin-left: 0;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}

/* Print Styles */
@media print {
    .app-header,
    .nav-tabs,
    .install-btn,
    .btn,
    .filter-controls {
        display: none;
    }
}

/* Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Lucide Icons Styles */
.category-icon svg,
.insight-icon svg,
.btn svg,
.btn-icon svg,
.delete-icon svg {
    display: inline-block;
    vertical-align: middle;
}

.category-icon svg {
    width: 1.2em;
    height: 1.2em;
    margin-right: 0.25rem;
}

.insight-icon svg {
    width: 24px;
    height: 24px;
}

.btn svg {
    width: 1.2em;
    height: 1.2em;
    margin-right: 0.5rem;
}

.btn-icon svg,
.delete-icon svg {
    width: 18px;
    height: 18px;
}
