/* Custom styles for Money Tracker - Financial Minimalist Design */

/* Additional utility classes */
.text-center {
    text-align: center;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* Transaction type colors */
.income {
    color: #10b981;
}

.expense {
    color: #ef4444;
}

/* Button styles */
button, .btn {
    background: #1e293b;
    color: white;
    border: none;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

button:hover, .btn:hover {
    background: #334155;
}

button.secondary {
    background: #f8fafc;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

button.secondary:hover {
    background: #f1f5f9;
}

/* Input styles */
input, select, textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    background: white;
    line-height: 1.5;
    min-height: 44px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23334155' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Date input with calendar icon */
input[type="date"] {
    position: relative;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #0f172a;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.tab-button:hover {
    color: #1e293b;
    background: #f8fafc;
}

.tab-button.active {
    color: #1e293b;
    border-bottom-color: #1e293b;
}

/* Form card */
.form-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.form-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
    color: #1e293b;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-card > div:not(.form-grid):not(.alert) {
    margin-bottom: 1rem;
}

.form-card > div:last-of-type:not(button) {
    margin-bottom: 1rem;
}

.form-card button[type="submit"] {
    margin-top: 1rem;
    width: 100%;
}

/* Transactions table */
.transactions-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    background: white;
}

.transactions-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.transactions-table th {
    text-align: left;
    padding: 1rem 0.75rem;
    background: #f8fafc;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
}

.transactions-table th:first-child {
    border-top-left-radius: 8px;
    padding-left: 1.25rem;
}

.transactions-table th:last-child {
    border-top-right-radius: 8px;
    padding-right: 1.25rem;
}

.transactions-table tbody tr {
    background: white;
    transition: background-color 0.15s;
}

.transactions-table tbody tr:hover {
    background: #f8fafc;
}

.transactions-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.875rem;
    color: #0f172a;
    vertical-align: middle;
    background: transparent;
}

.transactions-table td:first-child {
    padding-left: 1.25rem;
    font-weight: 500;
}

.transactions-table td:last-child {
    padding-right: 1.25rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: 16px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge.income {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.badge.expense {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Delete button */
.btn-delete {
    background: transparent;
    color: #ef4444;
    border: 1px solid #fecaca;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

/* Alert */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.alert.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

/* Exchange Grid Layout */
.exchange-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    margin: 1rem 0;
    align-items: start;
}

.exchange-box {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    border: 2px solid;
    transition: all 0.2s;
}

.exchange-box.sold {
    border-color: #fbbf24;
    background: linear-gradient(to bottom, #fffbeb, #ffffff);
}

.exchange-box.received {
    border-color: #10b981;
    background: linear-gradient(to bottom, #f0fdf4, #ffffff);
}

.exchange-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.exchange-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid;
}

.exchange-box.sold .exchange-header {
    border-bottom-color: #fde68a;
    color: #92400e;
}

.exchange-box.received .exchange-header {
    border-bottom-color: #a7f3d0;
    color: #065f46;
}

.exchange-header h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
}

.exchange-header svg {
    flex-shrink: 0;
}

.exchange-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    margin-top: 1rem;
}

.exchange-arrow svg {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Exchange Rate Display */
.exchange-rate-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 0.5rem 0;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.3);
}

.rate-icon {
    background: rgba(255,255,255,0.2);
    padding: 0.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rate-icon svg {
    color: white;
}

.rate-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.rate-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.9);
}

.rate-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .exchange-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .exchange-arrow {
        transform: rotate(90deg);
        margin: 0;
    }
}

/* Chart container */
.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 2rem;
}

/* Table styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
}

table th {
    text-align: left;
    padding: 0.75rem;
    background: var(--accent-bg);
}

table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

table tr:hover {
    background: var(--accent-bg);
}

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

/* Alert styles */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-error {
    background: #fee;
    border-left: 4px solid #f00;
    color: #c00;
}

.alert-success {
    background: #efe;
    border-left: 4px solid #0f0;
    color: #0a0;
}

.alert-info {
    background: #eff;
    border-left: 4px solid #0ff;
    color: #088;
}

/* Currency selector */
.currency-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.currency-selector button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
}

.currency-selector button.active {
    background: var(--accent);
    color: white;
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
