:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-hover: #252540;
    --text: #ffffff;
    --text-muted: #9ca3af;
    --border: #374151;
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border);
}

.back-btn {
    color: var(--text-muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.back-btn:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.header h1 {
    flex: 1;
    font-size: 1.5rem;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

#usernameDisplay {
    color: var(--primary-light);
    font-weight: 500;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

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

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Auth Container */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 30px;
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border);
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-weight: 500;
    color: var(--text);
}

.form-group small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.error-message {
    color: var(--danger);
    font-size: 0.9rem;
    margin-top: 10px;
}

.hidden {
    display: none !important;
}

/* Main App */
.main-app {
    animation: fadeIn 0.3s ease;
}

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

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 5px;
}

/* Month Navigation */
.month-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
}

.month-nav h2 {
    min-width: 200px;
    text-align: center;
}

.nav-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

/* Actions Bar */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

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

/* Calendar */
.calendar-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 30px;
    border: 1px solid var(--border);
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.cal-day {
    text-align: center;
    font-weight: 600;
    color: var(--text-muted);
    padding: 10px;
    font-size: 0.85rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.cal-cell {
    aspect-ratio: 1;
    background: var(--bg);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
}

.cal-cell:hover {
    background: var(--bg-hover);
}

.cal-cell.empty {
    background: transparent;
    cursor: default;
}

.cal-cell.today {
    border: 2px solid var(--primary);
}

.cal-cell.has-entry {
    background: rgba(99, 102, 241, 0.2);
}

.cal-date {
    font-size: 0.9rem;
    font-weight: 500;
}

.cal-hours {
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--success);
    font-weight: 600;
}

/* Entries List */
.entries-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
}

.entries-section h3 {
    margin-bottom: 20px;
}

.entries-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.entry-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    background: var(--bg);
    border-radius: 8px;
    gap: 15px;
}

.entry-info {
    flex: 1;
}

.entry-date {
    font-weight: 600;
    margin-bottom: 5px;
}

.entry-description {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.entry-hours {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
}

.entry-actions {
    display: flex;
    gap: 8px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 25px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border);
    margin: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.modal-close:hover {
    color: var(--text);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .app {
        padding: 15px;
    }

    .header {
        flex-wrap: wrap;
    }

    .header h1 {
        order: -1;
        width: 100%;
        text-align: center;
    }

    .user-section {
        width: 100%;
        justify-content: center;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .actions-bar {
        flex-direction: column;
    }

    .export-btns {
        width: 100%;
        justify-content: center;
    }

    .cal-cell {
        min-height: 60px;
        padding: 4px;
    }

    .cal-date {
        font-size: 0.8rem;
    }

    .cal-hours {
        font-size: 0.75rem;
    }

    .entry-item {
        flex-direction: column;
    }

    .entry-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
