/* Financial Preparedness Module Styles */

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Stats Card */
.stat-card {
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid var(--border-color, #e0e0e0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.stat-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-info h3,
#total-cash,
#total-metals,
#total-barter,
#total-value {
    font-size: clamp(1rem, 3vw, 1.5rem) !important;
    white-space: nowrap !important;
    line-height: 1.2 !important;
    margin: 0 !important;
    padding: 0 0.5rem !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    color: var(--primary-color, #2c5f2d) !important;
    font-weight: 700 !important;
}

.stat-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    white-space: nowrap;
}

.financial-header {
    margin-bottom: 2rem;
}

.financial-header h1 {
    color: var(--primary-color, #2c5f2d);
    margin: 0 0 0.5rem 0;
}

.financial-header p {
    color: var(--text-secondary, #666);
    margin: 0;
}

/* Tab Header */
.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.tab-header h2 {
    margin: 0;
    color: var(--text-primary, #333);
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-bar select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border-color, #ddd);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #333);
    cursor: pointer;
}

/* Financial List */
.financial-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.currency-group h3 {
    color: var(--primary-color, #2c5f2d);
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color, #2c5f2d);
}

.financial-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

/* Financial Item Card */
.financial-item {
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid var(--border-color, #e0e0e0);
    transition: transform 0.2s, box-shadow 0.2s;
}

.financial-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 0.5rem;
}

.item-header h4 {
    margin: 0;
    color: var(--text-primary, #333);
    font-size: 1.1rem;
    font-weight: 600;
}

.item-value {
    color: var(--primary-color, #2c5f2d);
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
}

.item-details span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.item-notes {
    margin: 0.5rem 0 0 0;
    padding: 0.5rem;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary, #555);
    font-style: italic;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #eee);
}

.expiration {
    color: #e65100 !important;
    font-weight: 600;
}

/* Metal Item Specific */
.metal-item .item-header h4 {
    color: #b8860b;
}

/* Barter Item Specific */
.barter-item .item-header h4 {
    color: #3949ab;
}

/* Transactions List */
.transactions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.transaction-item {
    background: var(--bg-primary, #fff);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-left: 4px solid var(--border-color, #ddd);
}

.transaction-item.type-add {
    border-left-color: #4caf50;
}

.transaction-item.type-remove {
    border-left-color: #f44336;
}

.transaction-item.type-trade {
    border-left-color: #2196f3;
}

.transaction-item.type-purchase {
    border-left-color: #ff9800;
}

.transaction-item.type-sale {
    border-left-color: #9c27b0;
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.transaction-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-primary, #333);
}

.transaction-date {
    font-size: 0.85rem;
    color: var(--text-muted, #888);
}

.transaction-body h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary, #333);
    font-size: 1rem;
}

.transaction-details {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
}

.transaction-value {
    font-weight: 600;
    color: var(--primary-color, #2c5f2d);
}

.transaction-notes {
    margin: 0.75rem 0 0 0;
    padding: 0.5rem;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary, #555);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e3f2fd;
    color: #1565c0;
}

/* Goals List */
.goals-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.goal-item {
    background: var(--bg-primary, #fff);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 2px solid var(--border-color, #e0e0e0);
}

.goal-item.status-active {
    border-color: #4caf50;
}

.goal-item.status-completed {
    border-color: #2196f3;
    opacity: 0.8;
}

.goal-item.status-paused {
    border-color: #ff9800;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.goal-header h4 {
    margin: 0;
    color: var(--text-primary, #333);
    font-size: 1.1rem;
}

.goal-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--bg-secondary, #f0f0f0);
    color: var(--text-primary, #333);
}

.goal-description {
    margin: 0 0 1rem 0;
    color: var(--text-secondary, #666);
    font-size: 0.9rem;
}

.goal-progress {
    margin-bottom: 1rem;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 24px;
    background: var(--bg-secondary, #e0e0e0);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2c5f2d, #4caf50);
    transition: width 0.5s ease;
    border-radius: 12px;
}

.progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    text-align: center;
    font-weight: 600;
}

.goal-deadline {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: var(--bg-primary, #fff);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    position: relative;
}

.modal-content h2 {
    margin: 0 0 1.5rem 0;
    color: var(--text-primary, #333);
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    color: var(--text-muted, #aaa);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: var(--text-primary, #333);
}

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

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary, #333);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color, #ddd);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-primary, #fff);
    color: var(--text-primary, #333);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color, #2c5f2d);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color, #eee);
}

/* Notifications */
.notification {
    position: fixed !important;
    bottom: 1.5rem !important;
    right: 1.5rem !important;
    padding: 0.5rem 0.75rem !important;
    border-radius: 6px !important;
    background: var(--bg-primary, #fff) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
    z-index: 2000 !important;
    animation: slideIn 0.3s ease !important;
    width: auto !important;
    max-width: 300px !important;
    height: auto !important;
    font-size: 0.8125rem !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    display: inline-block !important;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.notification-success {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

.notification-error {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.notification-info {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 4px solid #2196f3;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted, #999);
    font-size: 1.1rem;
    grid-column: 1 / -1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .financial-items {
        grid-template-columns: 1fr;
    }

    .goals-list {
        grid-template-columns: 1fr;
    }

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

    .tab-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }

    .modal-actions {
        flex-direction: column;
    }

    .modal-actions button {
        width: 100%;
    }

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

/* Dark Theme Support */
[data-theme="dark"] .financial-item,
[data-theme="dark"] .transaction-item,
[data-theme="dark"] .goal-item {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .item-notes,
[data-theme="dark"] .transaction-notes {
    background: #0f172a;
}

[data-theme="dark"] .modal-content {
    background: #1e293b;
}

[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .progress-bar {
    background: #334155;
}

[data-theme="dark"] .notification {
    background: #1e293b;
}
