/* css/settings.css - Settings specific styles */

/* Settings Sections */
.settings-section {
    margin-bottom: 30px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--dark);
    font-weight: 600;
}

.settings-section > p {
    font-size: 14px;
    color: var(--gray);
    margin-bottom: 20px;
}

/* Compact Budget Layout */
.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.budget-header h3 {
    font-size: 18px;
    color: var(--dark);
    margin: 0;
}

.budget-actions-compact {
    display: flex;
    gap: 10px;
}

.budget-actions-compact .btn.compact {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.budget-items-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.budget-item.compact {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s;
}

.budget-item.compact:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.budget-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.category-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 300px;
}

.icon-input-compact {
    width: 36px;
    height: 36px;
    text-align: center;
    font-size: 18px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--light);
    transition: all 0.2s;
}

.icon-input-compact:hover {
    border-color: var(--primary);
    background: white;
}

.icon-input-compact:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.category-name-input-compact {
    border: none;
    background: transparent;
    font-weight: 600;
    font-size: 15px;
    color: var(--dark);
    padding: 6px 0;
    border-bottom: 1px solid transparent;
    flex: 1;
    transition: all 0.2s;
}

.category-name-input-compact:hover:not([readonly]) {
    border-bottom-color: var(--border);
}

.category-name-input-compact:focus {
    outline: none;
    border-bottom-color: var(--primary);
}

.category-name-input-compact[readonly] {
    cursor: default;
    opacity: 0.7;
}

.budget-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: flex-end;
}

.spending-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.spent-label {
    color: var(--gray);
    font-size: 13px;
}

.spent-amount {
    font-weight: 600;
    color: var(--dark);
}

.remaining-amount {
    font-size: 13px;
}

.remaining-amount.positive {
    color: var(--success);
}

.remaining-amount.negative {
    color: var(--danger);
}

.budget-input-compact {
    display: flex;
    align-items: center;
    gap: 6px;
}

.budget-field {
    width: 100px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s;
}

.budget-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.budget-field::placeholder {
    color: #9ca3af;
}

.btn-set-budget {
    padding: 6px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-set-budget:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-remove-compact {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove-compact:hover {
    background: #fee2e2;
    color: var(--danger);
}

.budget-progress-compact {
    height: 3px;
    background: var(--light);
    border-radius: 2px;
    overflow: hidden;
    margin: 10px 0 8px;
}

.budget-progress-compact .budget-progress-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 2px;
    background: var(--success);
}

.budget-progress-compact .budget-progress-fill.warning {
    background: var(--warning);
}

.budget-progress-compact .budget-progress-fill.danger {
    background: var(--danger);
}

.keywords-row {
    margin-top: 8px;
}

.keywords-input-compact {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
    background: var(--light);
    transition: all 0.2s;
}

.keywords-input-compact:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.keywords-input-compact::placeholder {
    color: #9ca3af;
    font-family: inherit;
}

/* Merchant Rules List */
#merchantRulesList {
    background: var(--light);
    border-radius: 8px;
    padding: 16px;
}

#merchantRulesList button {
    margin-bottom: 12px;
}

#merchantRulesList > div > div {
    background: white !important;
    border: 1px solid var(--border) !important;
    border-radius: 6px !important;
    padding: 12px 16px !important;
    margin: 8px 0 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

#merchantRulesList > div > div:hover {
    border-color: var(--primary) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Danger Zone */
.settings-section:last-child {
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.settings-section:last-child .btn-danger {
    background: var(--danger);
    color: white;
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-section:last-child .btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .budget-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .budget-actions-compact {
        width: 100%;
    }

    .budget-actions-compact .btn.compact {
        flex: 1;
    }

    .budget-item-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .category-info {
        flex: 1;
        width: 100%;
    }

    .budget-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .spending-info {
        justify-content: space-between;
    }

    .budget-input-compact {
        width: 100%;
    }

    .budget-field {
        flex: 1;
    }

    .btn-remove-compact {
        align-self: flex-end;
        margin-top: -40px;
    }
}

.month-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.month-selector label {
    font-size: 14px;
    font-weight: 500;
    color: var(--dark);
}

.month-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    min-width: 200px;
    background: white;
}

/* Focus States for Accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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

::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 4px;
}

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

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

/* Remove old styles that are no longer needed */
.budget-item.expanded {
    display: none !important;
}

.budget-actions {
    display: none !important;
}

.settings-notice {
    display: none !important;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-bottom: 2px solid var(--border);
    background: var(--light);
}

.settings-tab {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.settings-tab:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

.settings-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.settings-content {
    padding: 20px;
    display: none;
}

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

/* Data Management Styles */
.data-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.data-action-card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
}

.data-action-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.data-action-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.data-action-card h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--dark);
}

.data-action-card p {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 15px;
}

.export-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.storage-stats {
    background: var(--light);
    padding: 20px;
    border-radius: 8px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.danger-zone {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 8px;
    padding: 20px;
}

.danger-zone h3 {
    color: #991b1b;
}

/* Unsaved changes indicator */
#saveChangesBtn.pulse {
    animation: pulse 1.5s infinite;
    background: var(--warning);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(245, 158, 11, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

#unsavedNotice {
    animation: slideDown 0.3s ease;
}

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