/* Fallback CSS for offline mode when Tailwind CDN is unavailable */
/* This provides essential styling to keep the app functional */

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background-color: #f9fafb;
    transition: all 0.3s ease;
}

/* Dark mode */
.dark body {
    color: #f3f4f6;
    background-color: #111827;
}

/* Container and layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header styles */
header {
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid #e5e7eb;
}

.dark header {
    background: #1f2937;
    border-bottom-color: #374151;
}

/* Navigation */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: #059669;
}

.logo img {
    width: 2rem;
    height: 2rem;
}

/* Navigation styles */
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.nav-link.active {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.dark .nav-link {
    color: #9ca3af;
}

.dark .nav-link:hover {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}

.dark .nav-link.active {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}

/* Mobile navigation */
.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.mobile-nav-link:hover {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.mobile-nav-link.active {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.mobile-nav-link svg {
    margin-right: 0.75rem;
}

.dark .mobile-nav-link {
    color: #9ca3af;
}

.dark .mobile-nav-link:hover {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}

.dark .mobile-nav-link.active {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-ghost {
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.btn-ghost:hover {
    background: #f3f4f6;
}

.dark .btn-ghost {
    color: #9ca3af;
    border-color: #4b5563;
}

.dark .btn-ghost:hover {
    background: #374151;
}

/* Icon buttons */
.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
}

/* Form elements */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.dark .form-label {
    color: #d1d5db;
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

.dark .form-input {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background: white;
    font-size: 1rem;
}

.dark .form-select {
    background: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.dark .card {
    background: #1f2937;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Summary cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .summary-card {
    background: #1f2937;
}

.summary-card h3 {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.summary-card .amount {
    font-size: 1.5rem;
    font-weight: 700;
}

.amount-positive {
    color: #059669;
}

.amount-negative {
    color: #dc2626;
}

.amount-neutral {
    color: #6b7280;
}

/* Transaction list */
.transaction-list {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.dark .transaction-list {
    background: #1f2937;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.transaction-item:hover {
    background: #f9fafb;
}

.dark .transaction-item {
    border-bottom-color: #374151;
}

.dark .transaction-item:hover {
    background: #374151;
}

.transaction-item:last-child {
    border-bottom: none;
}

.transaction-info {
    flex: 1;
}

.transaction-description {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.transaction-meta {
    font-size: 0.875rem;
    color: #6b7280;
}

.dark .transaction-meta {
    color: #9ca3af;
}

.transaction-amount {
    font-weight: 600;
    margin-right: 1rem;
}

.transaction-actions {
    display: flex;
    gap: 0.5rem;
}

/* Modals */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.dark .modal-content {
    background: #1f2937;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.modal-close:hover {
    color: #374151;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dark .filters {
    background: #1f2937;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

/* Quick add buttons */
.quick-add-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.quick-add-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.quick-add-btn:hover {
    background: #f3f4f6;
    border-color: #059669;
}

.dark .quick-add-btn {
    background: #374151;
    border-color: #4b5563;
}

.dark .quick-add-btn:hover {
    background: #4b5563;
}

.quick-add-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.quick-add-text {
    font-size: 0.75rem;
    text-align: center;
}

/* Loading states */
.loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #059669;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notifications */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    color: white;
    font-weight: 500;
    z-index: 60;
    animation: slideIn 0.3s ease-out;
}

.notification-success {
    background: #059669;
}

.notification-error {
    background: #dc2626;
}

.notification-info {
    background: #2563eb;
}

.notification-warning {
    background: #d97706;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Utility classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .modal-content {
        margin: 0.5rem;
        padding: 1rem;
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: auto;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .transaction-amount {
        margin-right: 0;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.dark .empty-state {
    color: #9ca3af;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-description {
    margin-bottom: 1.5rem;
}

/* Category icons */
.category-icon {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    text-align: center;
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    background: #d97706;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

/* Install prompt */
.install-prompt {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: #059669;
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 300px;
    z-index: 50;
}

.install-prompt-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.install-prompt-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.install-prompt-btn {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0.25rem;
    background: transparent;
    color: white;
    cursor: pointer;
    font-size: 0.875rem;
}

.install-prompt-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Page content management */
.page-content {
    display: block;
}

.page-content.hidden {
    display: none !important;
}

/* Sidebar animations */
.sidebar-open {
    transform: translateX(0) !important;
}

/* Progress bars */
.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 0.25rem;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.dark .progress-bar {
    background-color: #374151;
}

.progress-fill {
    height: 100%;
    background-color: #10b981;
    transition: width 0.3s ease;
}

/* Navigation Styles */
.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.nav-link.active {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.dark .nav-link {
    color: #9ca3af;
}

.dark .nav-link:hover {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}

.dark .nav-link.active {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}

/* Mobile Navigation */
.mobile-nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: #6b7280;
    text-decoration: none;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.mobile-nav-link:hover {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.mobile-nav-link.active {
    color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.1);
}

.mobile-nav-link svg {
    margin-right: 0.75rem;
}

.dark .mobile-nav-link {
    color: #9ca3af;
}

.dark .mobile-nav-link:hover {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}

.dark .mobile-nav-link.active {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.1);
}

/* Page Management */
.page-content {
    animation: fadeIn 0.3s ease-in-out;
}

.page-content.hidden {
    display: none;
}

/* Analytics Cards */
.analytics-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.analytics-card h3 {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.analytics-card p {
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 700;
}

.dark .analytics-card {
    background: #1f2937;
    border-color: #374151;
}

.dark .analytics-card h3 {
    color: #9ca3af;
}

.dark .analytics-card p {
    color: #f9fafb;
}

/* Analytics Charts */
.analytics-chart {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.analytics-chart h3 {
    color: #1f2937;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.dark .analytics-chart {
    background: #1f2937;
    border-color: #374151;
}

.dark .analytics-chart h3 {
    color: #f9fafb;
}

.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6b7280;
    font-style: italic;
}

/* Category Cards */
.category-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.category-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.category-icon {
    width: 3rem;
    height: 3rem;
    background-color: #f3f4f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.dark .category-card {
    background: #1f2937;
    border-color: #374151;
}

.dark .category-icon {
    background-color: #374151;
}

/* Goal Cards */
.goal-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.goal-card h3 {
    color: #1f2937;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 0.25rem;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background-color: #10b981;
    transition: width 0.3s ease;
}

.dark .goal-card {
    background: #1f2937;
    border-color: #374151;
}

.dark .goal-card h3 {
    color: #f9fafb;
}

.dark .progress-bar {
    background-color: #374151;
}

/* Report Cards */
.report-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    text-align: center;
}

.report-card h3 {
    color: #1f2937;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.report-card p {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.dark .report-card {
    background: #1f2937;
    border-color: #374151;
}

.dark .report-card h3 {
    color: #f9fafb;
}

.dark .report-card p {
    color: #9ca3af;
}

/* Settings Sections */
.settings-section {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
}

.settings-section h3 {
    color: #1f2937;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-item label {
    color: #1f2937;
    font-weight: 500;
}

.dark .settings-section {
    background: #1f2937;
    border-color: #374151;
}

.dark .settings-section h3 {
    color: #f9fafb;
}

.dark .setting-item {
    border-bottom-color: #374151;
}

.dark .setting-item label {
    color: #f9fafb;
}

/* Button Styles */
.btn-primary {
    background-color: #3b82f6;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background-color: #dc2626;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .analytics-card {
        padding: 1rem;
    }
    
    .category-card {
        padding: 1rem;
    }
    
    .goal-card {
        padding: 1rem;
    }
    
    .report-card {
        padding: 1rem;
    }
    
    .settings-section {
        padding: 1rem;
    }
}
