/* CSS for EZTIMETRACKER - Refactored for Premium Look */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --secondary-color: #81C784;
    --accent-color: #FFC107;
    --success-color: #4CAF50;
    --warning-color: #FF9800; /* Kept as it's used by .btn-backup */
    --danger-color: #F44336;
    --info-color: #00BCD4; /* Kept as it's used by .btn-cloud-check */
    --income-color: #4CAF50;
    --expense-color: #F44336;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --text-primary: #1a1a1b; /* Renamed from --text-color */
    --text-secondary: #65676b;
    --border-color: #dddfe2;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05); /* Replaced --shadow */
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1); /* New shadow level */
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    font-size: 16px; 
    background: var(--bg-color); 
    color: var(--text-primary); /* Changed to --text-primary */
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

.container { 
    max-width: 600px; 
    margin: 0 auto; 
    background: var(--card-bg); 
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

.header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm); /* Changed to --shadow-sm */
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.5px; }
.btn-help {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 16px;
    border: 1px solid rgba(255,255,255,0.3);
}
.btn-help:hover { background: rgba(255,255,255,0.3); }

.controls {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--card-bg);
    position: sticky;
    top: 72px;
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    align-items: center;
}

select {
    flex: 1;
    padding: 10px 8px;
    font-size: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary); /* Changed to --text-primary */
    outline: none;
    transition: border-color 0.2s;
}

select:focus { border-color: var(--primary-color); }

.btn-accounts { background: #673AB7; color: white; }
.btn-categories { background: #FF9800; color: white; }
.btn-excel { background: #2E7D32; color: white; }
.btn-reminders { background-color: #9C27B0; color: white; flex-shrink: 0; }

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
}

.icon-btn:hover { transform: scale(1.05); }
.icon-btn:active { transform: scale(0.95); }


button {
    padding: 10px 14px;
    font-size: 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

button:active { transform: scale(0.95); }

.btn-primary { background: var(--primary-color); color: white; }
.btn-summary { background: var(--success-color); color: white; }
.btn-backup { background: var(--warning-color); color: white; }
.btn-settings { background: #607D8B; color: white; }
.btn-print { background: #3F51B5; color: white; }
.btn-cloud { background: #673AB7; color: white; width: 100%; margin-bottom: 8px; font-size: 16px; padding: 12px; font-weight: 500; }
.btn-cloud-check { background: var(--info-color); color: white; }

.controls button {
    padding: 8px 10px;
    font-size: 16px;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    padding: 8px;
    background: #eee;
}

.day-cell {
    background: white;
    padding: 15px 5px;
    text-align: center;
    cursor: pointer;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
    position: relative;
}

.day-cell:hover { background: #f0f7ff; }
.day-number { font-weight: 500; font-size: 16px; color: #444; }
.day-hours { font-size: 12px; color: var(--primary-color); font-weight: 600; margin-top: 2px; }
.day-notes-indicator { position: absolute; top: 4px; left: 4px; font-size: 10px; }
.day-reminder-indicator { position: absolute; top: 4px; right: 4px; display: flex; gap: 2px; }
.reminder-dot { width: 6px; height: 6px; border-radius: 50%; }
.dot-generic { background-color: #9C27B0; }
.dot-expense { background-color: #F44336; }
.dot-income { background-color: #4CAF50; }

.saturday { background: #fffaf0; }
.sunday { background: #fff5f5; }
.has-entries { background: #e8f5e9 !important; }
.other-month { opacity: 0.3; pointer-events: none; }

/* MODALS */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal-content {
    background: white;
    margin: 1.5rem auto;
    width: 92%;
    max-width: 450px;
    border-radius: 16px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 { font-size: 18px; font-weight: 600; }
.close { font-size: 24px; cursor: pointer; color: #bbb; }

.modal-body { padding: 24px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; color: var(--text-secondary); font-weight: 500; }
.form-group select, .form-group input, .form-group textarea {
    width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--border-color); border-radius: 10px; font-family: inherit; background: #fff;
}
.form-group textarea { min-height: 90px; }

.form-group label:has(input[type="radio"]) {
    transition: all 0.2s;
}

.form-group label:has(input[type="radio"]):hover {
    background: #f0f7ff;
    border-color: var(--primary-color) !important;
}

.form-group label:has(input[type="radio"]):has(input:checked) {
    background: #e3f2fd;
    border-color: var(--primary-color) !important;
    font-weight: 600;
}


.time-row { display: flex; gap: 12px; }
.time-row > div { flex: 1; }

.entry-list { margin-top: 20px; }
.entry-item-modal {
    display: flex; justify-content: space-between; align-items: center; padding: 14px;
    background: #f9fbfd; margin-bottom: 8px; border-radius: 12px; border: 1px solid #edf2f7;
}
.entry-info { display: flex; flex-direction: column; gap: 2px; }

.movement-income { border-left: 5px solid #4CAF50 !important; }
.movement-expense { border-left: 5px solid #F44336 !important; }

.movement-income.editing, .movement-expense.editing {
    border: 2px solid var(--primary-color);
    background: #e3f2fd;
}


.forecast-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.forecast-table th, .forecast-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.forecast-table th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.forecast-positive { color: #2e7d32; font-weight: 600; }
.forecast-negative { color: #c62828; font-weight: 600; }

.reminder-item {
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    border-left: 5px solid #9C27B0;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reminder-item.expense { border-left-color: #F44336; }
.reminder-item.income { border-left-color: #4CAF50; }

.reminder-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.reminder-date {
    font-size: 0.8rem;
    color: #666;
}

.reminder-desc {
    font-weight: 600;
}

.reminder-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.forecast-summary-card {
    background: #e3f2fd;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
    border: 1px solid #bbdefb;
}

.forecast-summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.forecast-summary-label { font-size: 0.9rem; color: #1565c0; }
.forecast-summary-value { font-weight: 700; }
.entry-time-range { font-size: 12px; color: #888; }
.entry-meta { font-size: 11px; color: #aab; font-style: italic; }

.btn-delete { background: #fee2e2; color: var(--danger-color); font-weight: 600; border-radius: 6px; padding: 6px 10px; font-size: 14px; }

.summary-card {
    background: #f1f8ff; padding: 24px; margin: 16px; border-radius: 16px; text-align: center;
    border: 1px solid #e1effe;
}
.summary-label { font-size: 14px; color: #5c6c7b; margin-bottom: 4px; }
.summary-value { font-size: 36px; font-weight: 700; color: var(--primary-color); line-height: 1; }
.summary-subtext { font-size: 14px; color: #5c6c7b; margin-top: 4px; }

#toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 50px;
    padding: 16px;
    position: fixed;
    z-index: 2000;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}
#toast.show { visibility: visible; opacity: 1; bottom: 60px; }

.db-status { position: fixed; bottom: 20px; left: 20px; background: rgba(76, 175, 80, 0.9); color: white; padding: 6px 12px; border-radius: 20px; font-size: 11px; font-weight: 500; }

.tabs { display: flex; background: #f0f2f5; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.tab { flex: 1; padding: 10px; text-align: center; cursor: pointer; border-radius: 8px; font-size: 14px; font-weight: 500; transition: all 0.2s; }
.tab.active { background: white; box-shadow: 0 2px 4px rgba(0,0,0,0.05); color: var(--primary-color); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* MEDIA QUERIES FOR MOBILE */
@media screen and (max-width: 480px) {
    .controls {
        gap: 4px;
        padding: 8px;
    }
    .controls select {
        padding: 8px 4px;
        font-size: 13px;
    }
    .controls button {
        padding: 6px 8px;
        font-size: 14px;
    }
    .btn-reminders {
        font-size: 1rem;
        padding: 6px 8px;
    }
}

/* MANAGEMENT TABLES */
.table-container {
    max-height: 350px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 12px;
    margin-top: 10px;
}

.mgmt-table {
    width: 100%;
    border-collapse: collapse;
}

.mgmt-table th, .mgmt-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.mgmt-table th {
    background: #f8f9fa;
    color: #666;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mgmt-table tr:last-child td { border-bottom: none; }

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.badge-income { background: #e8f5e9; color: #2e7d32; }
.badge-expense { background: #ffebee; color: #c62828; }

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    transition: transform 0.2s;
}

.action-btn:hover { transform: scale(1.2); }
