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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Auth Page Styles */
.container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-box {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

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

.logo h1 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.logo p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.tabs {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: -2px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

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

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

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

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

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

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

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

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

.btn-secondary:hover {
    background: #475569;
}

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    width: auto;
}

.error-message {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.75rem;
    text-align: center;
}

/* Dashboard Styles */
.dashboard-container {
    min-height: 100vh;
    background: var(--background);
}

.dashboard-header {
    background: var(--surface);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-header .logo h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info span {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.dashboard-main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.add-task-section {
    background: var(--surface);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.add-task-section h2 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-row .btn {
    width: auto;
    white-space: nowrap;
}

.tasks-section {
    background: var(--surface);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.tasks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.tasks-header h2 {
    color: var(--text-primary);
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--surface);
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 0.2s;
}

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

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

.tasks-list {
    display: grid;
    gap: 1rem;
}

.task-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.task-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--primary-color);
}

.task-info {
    flex: 1;
}

.task-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.task-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.task-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.task-status {
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-PENDING {
    background: #fef3c7;
    color: #92400e;
}

.status-IN_PROGRESS {
    background: #dbeafe;
    color: #1e40af;
}

.status-COMPLETED {
    background: #d1fae5;
    color: #065f46;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
}

.no-tasks {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    color: var(--text-primary);
}

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

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.modal-actions .btn {
    width: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .auth-box {
        padding: 1.5rem;
    }

    .dashboard-header {
        padding: 1rem;
    }

    .dashboard-main {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .btn {
        width: 100%;
    }

    .tasks-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filter-buttons {
        flex-wrap: wrap;
    }

    .task-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

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

/* Server Status Toast (Cold Start UX) */
.server-toast {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: 400px;
    padding: 0.875rem 1.125rem;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.875rem;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(-0.75rem);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.server-toast.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.server-toast.connected {
    border-left-color: var(--success-color);
}

.server-toast-spinner {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    border: 2.5px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: server-toast-spin 0.8s linear infinite;
}

.server-toast.connected .server-toast-spinner {
    display: none;
}

.server-toast-message {
    flex: 1;
}

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

@media (max-width: 768px) {
    .server-toast {
        top: 0.75rem;
        left: 0.75rem;
        right: 0.75rem;
        max-width: none;
    }
}
