/* LunchMoney Transaction Generator - Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-color: #1e293b;
    --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);
}

* {
    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);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.2rem;
    color: var(--secondary-color);
}

.card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.warning {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.warning p {
    margin-bottom: 0.5rem;
}

.warning p:last-child {
    margin-bottom: 0;
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--secondary-color);
    font-size: 0.875rem;
}

.form-group small a {
    color: var(--primary-color);
    text-decoration: none;
}

.form-group small a:hover {
    text-decoration: underline;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover:not(:disabled) {
    background: #475569;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

.account-details {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    padding: 1rem;
}

.account-details p {
    margin-bottom: 0.5rem;
}

.account-details p:last-child {
    margin-bottom: 0;
}

.account-details .success {
    color: var(--success-color);
    font-weight: 600;
}

.account-details .warning {
    color: var(--warning-color);
    font-weight: 600;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.warning-text {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 0.5rem;
    color: #92400e;
    font-size: 0.95rem;
}

.warning-text strong {
    color: #d97706;
}

.setup-instructions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.setup-step {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.setup-step:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.setup-step h4 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 600;
}

.setup-step p {
    margin: 0;
    color: var(--text-color);
    line-height: 1.6;
}

.setup-step a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.setup-step a:hover {
    text-decoration: underline;
}

.preview {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.preview h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.transaction-preview h4 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.transaction-preview ul {
    list-style: none;
    padding-left: 0;
}

.transaction-preview li {
    padding: 0.25rem 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.total-preview {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
}

.automatic-payments-info {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.safety-check {
    margin-bottom: 1.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-container input[type="checkbox"] {
    width: auto;
    margin-right: 0.75rem;
    transform: scale(1.2);
}

.account-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.account-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    transition: all 0.2s ease;
}

/* Make loan and mortgage items full width */
#account-loan:checked ~ .account-inputs,
#account-mortgage:checked ~ .account-inputs {
    width: 100%;
}

/* Target parent account-item when loan or mortgage */
.account-item:has(#account-loan),
.account-item:has(#account-mortgage) {
    grid-column: 1 / -1;
    width: 100%;
}

.account-item:hover {
    background: #f0f9ff;
    border-color: var(--primary-color);
}

.account-types .checkbox-container {
    margin: 0;
    flex: 1;
}

.account-types .checkbox-container span {
    font-size: 0.95rem;
}

.balance-input {
    width: 120px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: right;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text-color);
}

.balance-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.balance-input::placeholder {
    color: var(--secondary-color);
}

.account-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rate-input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: right;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text-color);
}

.rate-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.rate-label {
    font-size: 0.875rem;
    color: var(--secondary-color);
    white-space: nowrap;
}

.term-input {
    width: 80px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: right;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text-color);
}

.term-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.currency-select {
    width: 100px;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.currency-select:hover {
    border-color: var(--primary-color);
}

.foreign-examples {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.foreign-examples h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.foreign-examples small {
    display: block;
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.preset-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.preset-btn {
    padding: 0.5rem 1rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.preset-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 4px;
}

#progressText {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

#progressLog {
    max-height: 200px;
    overflow-y: auto;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 1rem;
}

.log-entry {
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 0.25rem;
}

.log-entry:last-child {
    margin-bottom: 0;
}

.success-message {
    background: #f0fdf4;
    border: 1px solid #22c55e;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.success-message h3 {
    color: var(--success-color);
    margin-bottom: 0.5rem;
}

.error-message {
    background: #fef2f2;
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.error-message h3 {
    color: var(--error-color);
    margin-bottom: 0.5rem;
}

.recurring-patterns {
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.recurring-patterns h4 {
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.recurring-patterns ul {
    list-style: none;
    padding-left: 0;
}

.recurring-patterns li {
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
    font-size: 0.875rem;
}

.recurring-patterns li:last-child {
    border-bottom: none;
}

.next-steps {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    padding: 1.5rem;
}

.next-steps h4 {
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.next-steps ul {
    padding-left: 1.5rem;
}

.next-steps li {
    margin-bottom: 0.5rem;
}

.next-steps li:last-child {
    margin-bottom: 0;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
}

footer p {
    margin-bottom: 0.5rem;
}

footer p:last-child {
    margin-bottom: 0;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Remove all number input spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 1rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background-color: #0f172a;
        --card-background: #1e293b;
        --text-color: #f1f5f9;
        --border-color: #334155;
        --secondary-color: #94a3b8;
    }
    
    .warning {
        background: #451a03;
        border-color: #d97706;
        color: #fbbf24;
    }
    
    .account-details {
        background: #0c4a6e;
        border-color: #0ea5e9;
    }
    
    .preview {
        background: #1e293b;
        border-color: #334155;
    }
    
    .total-preview {
        background: #0c4a6e;
        border-color: #0ea5e9;
    }
    
    .success-message {
        background: #064e3b;
        border-color: #22c55e;
    }
    
    .error-message {
        background: #7f1d1d;
        border-color: #ef4444;
    }
    
    .recurring-patterns {
        background: #1e293b;
        border-color: #334155;
    }
    
    .next-steps {
        background: #0c4a6e;
        border-color: #0ea5e9;
    }
    
    #progressLog {
        background: #1e293b;
        border-color: #334155;
    }
    
    .account-types {
        background: #1e293b;
        border-color: #334155;
    }
    
    .account-item {
        background: #334155;
        border-color: #475569;
    }
    
    .account-item:hover {
        background: #0c4a6e;
        border-color: #0ea5e9;
    }
    
    .balance-input {
        background: #1e293b;
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .balance-input:focus {
        border-color: #0ea5e9;
        box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
    }
    
    .automatic-payments-info {
        background: #451a03;
        border-color: #d97706;
        color: #fbbf24;
    }
    
    .rate-input {
        background: #1e293b;
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .rate-input:focus {
        border-color: #0ea5e9;
        box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
    }
    
    .term-input {
        background: #1e293b;
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .term-input:focus {
        border-color: #0ea5e9;
        box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
    }
}

/* Animation for smooth transitions */
.card {
    animation: fadeInUp 0.5s ease-out;
}

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

/* Loading states */
.btn:disabled {
    position: relative;
    overflow: hidden;
}

.btn:disabled::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}