/* trp.css - COMPLETE FIXED VERSION */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent-blue: #3b82f6;
    --accent-green: #10b981;
    --accent-orange: #f59e0b;
    --accent-red: #ef4444;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 10px 25px rgba(0,0,0,0.08);
    --shadow-lg: 0 20px 40px rgba(0,0,0,0.12);
    --radius-sm: 12px;
    --radius-lg: 24px;
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --surface: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-blue: #60a5fa;
    --accent-green: #34d399;
    --accent-orange: #fbbf24;
    --accent-red: #f87171;
    --border-color: #334155;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #e2e8f0 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem 1rem;
    line-height: 1.6;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body[data-theme="dark"] {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1e1b4b 100%);
}

/* Theme Toggle */
.theme-control {
    position: sticky;
    top: 1rem;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    padding: 1rem 0;
    max-width: 1200px;
    margin: 0 auto 2rem;
}

.theme-toggle {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-blue);
}

[data-theme="dark"] .theme-toggle {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

/* Header */
.tracker-header {
    max-width: 1200px;
    margin: 0 auto 3rem;
    text-align: center;
}

.page-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

/* Action Buttons */
.action-bar {
    max-width: 1200px;
    margin: 0 auto 3rem;
    padding: 2rem;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
}

.button-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
    min-height: 52px;
}

.edit-btn {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
}

.add-btn {
    background: linear-gradient(135deg, var(--accent-green), #059669);
    color: white;
}

#delete-habit-btn {
    background: linear-gradient(135deg, var(--accent-orange), #d97706);
    color: white;
}

.reset-btn {
    background: linear-gradient(135deg, var(--accent-red), #dc2626);
    color: white;
}

.action-btn:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

#delete-habit-btn:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* FIXED TABLE CONTAINER - TABLE VISIBLE */
.table-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: auto;
    max-height: 80vh;
    border: 1px solid var(--border-color);
    display: block !important;
}

/* FIXED HABIT TABLE - VISIBLE + SCROLLABLE */
.habit-table {
    width: 100%;
    min-width: 1000px;
    border-collapse: collapse;
    font-size: 0.95rem;
    table-layout: auto;
}

.habit-table th,
.habit-table td {
    padding: 1rem 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    white-space: nowrap;
}

.habit-table th:first-child,
.habit-table td:first-child {
    text-align: left;
    padding-left: 1.5rem;
    min-width: 200px;
    width: 200px;
    position: sticky;
    left: 0;
    z-index: 5;
    background: var(--surface) !important;
    border-right: 2px solid var(--border-color);
}

/* BULLETPROOF TODAY HIGHLIGHT - TOP PRIORITY */
#today-column,
.habit-table th.today,
.habit-table th.today * {
    background: #FFD700 !important;
    color: #000 !important;
    font-weight: 700 !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
    z-index: 100 !important;
}

/* Header styles */
.habit-table th {
    background: linear-gradient(135deg, var(--accent-blue), #2563eb);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
}

.habit-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Scrollbars */
.table-container::-webkit-scrollbar {
    height: 8px;
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--border-color);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--accent-blue);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #2563eb;
}

.habit-check {
    width: 20px;
    height: 20px;
    accent-color: var(--accent-green);
    cursor: pointer;
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.habit-check:hover {
    transform: scale(1.3);
}

.habit-check:checked {
    background-color: var(--accent-green) !important;
    border-color: var(--accent-green) !important;
}

/* Content editable */
.habit-table td[contenteditable="true"] {
    background: rgba(59, 130, 246, 0.1);
    border-radius: 8px;
    cursor: text;
}

[data-theme="dark"] .habit-table td[contenteditable="true"] {
    background: rgba(59, 130, 246, 0.2);
}

.habit-table tr {
    transition: background 0.2s ease;
}

.habit-table tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

[data-theme="dark"] .habit-table tr:hover {
    background: rgba(59, 130, 246, 0.15);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        padding: 1rem 0.5rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .action-bar {
        padding: 1.5rem;
        margin: 0 auto 2rem;
    }
    
    .button-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-btn {
        justify-content: center;
    }
    
    .table-container {
        margin: 0 -0.5rem;
        border-radius: 16px;
        min-width: calc(100vw - 1rem);
    }
    
    .habit-table {
        min-width: 800px;
    }
}

@media (max-width: 480px) {
    .theme-control {
        padding: 0.5rem 1rem;
    }
}

/* Focus accessibility */
.action-btn:focus,
.theme-toggle:focus,
.habit-check:focus {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Smooth animations */
* {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
