/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --secondary-hover: #475569;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --success-color: #16a34a;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo img {
    width: 32px;
    height: 32px;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

header nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.user-info strong {
    color: var(--text-primary);
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.role-user {
    background-color: #dbeafe;
    color: #1e40af;
}

.role-admin {
    background-color: #fef3c7;
    color: #92400e;
}

/* Main Content */
main {
    min-height: calc(100vh - 120px);
    padding: 2rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
}

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Features Grid */
.features {
    padding: 4rem 0;
}

.features h3 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 3rem;
}

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

.feature-card {
    background-color: var(--surface);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    text-align: center;
}

.feature-card h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
}

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

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

.auth-card h2 {
    text-align: center;
    margin-bottom: 0.5rem;
}

.auth-card p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
}

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

/* App Layout */
.app-container {
    display: flex;
    gap: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.sidebar {
    width: 250px;
    background-color: var(--surface);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.nav-link:hover {
    background-color: var(--background);
    color: var(--text-primary);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

.content {
    flex: 1;
    background-color: var(--surface);
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--background);
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
}

.stat-card h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

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

/* Actions */
.actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Test Results */
.test-results {
    margin-top: 2rem;
}

/* Test Setup Styles */
.test-setup {
    background: var(--background);
    padding: 0;
    border-radius: 8px;
    margin-top: 2rem;
}

.collapsible-header {
    width: 100%;
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.collapsible-header:hover {
    background: var(--surface);
    border-color: var(--primary-color);
}

.collapsible-content {
    padding: 2rem;
    animation: slideDown 0.3s ease;
}

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

.test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.test-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.test-card h4 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

.test-card p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.test-card button {
    margin-top: 0.5rem;
    width: 100%;
}

.llm-test {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.llm-test input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.test-success {
    background: #10b981;
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 2rem;
    text-align: center;
}

.test-success h4 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

/* Logo Icon */
.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

/* Todo List Styles */
.todos-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.add-todo-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    transition: all 0.3s ease;
}

.add-todo-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.plus-icon {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Quick Add */
.quick-add {
    margin-bottom: 2rem;
}

.quick-add input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background: var(--background);
}

.quick-add input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: white;
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--background);
    padding: 0.5rem;
    border-radius: 12px;
}

.filter-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}

.filter-tab:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.filter-tab.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* Todos Container */
.todos-container {
    margin-bottom: 2rem;
}

.todos-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Todo Items */
.todo-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.todo-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.todo-item.completed {
    opacity: 0.7;
    background: var(--background);
}

.todo-item.completed .todo-title {
    text-decoration: line-through;
    color: var(--text-secondary);
}

.todo-item.overdue {
    border-left: 4px solid var(--danger-color);
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.02), white);
}

/* Todo Checkbox */
.todo-checkbox {
    margin-top: 0.25rem;
}

.todo-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    appearance: none;
    background: white;
}

.todo-checkbox input[type="checkbox"]:checked {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.todo-checkbox input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Todo Content */
.todo-content {
    flex: 1;
    min-width: 0;
}

.todo-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.todo-description {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.todo-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
}

/* Priority Badges */
.priority {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-low {
    background: #e0f2fe;
    color: #0369a1;
}

.priority-medium {
    background: #fef3c7;
    color: #92400e;
}

.priority-high {
    background: #fee2e2;
    color: #dc2626;
}

/* Due Date */
.due-date {
    color: var(--text-secondary);
}

.due-date.overdue {
    color: var(--danger-color);
    font-weight: 600;
}

.created-date {
    color: var(--text-secondary);
}

/* Todo Actions */
.todo-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

/* Todo Stats */
.todo-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--background);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.separator {
    color: var(--border-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    color: var(--text-secondary);
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: white;
}

.form-group select:focus,
.form-group input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Responsive Todo Styles */
@media (max-width: 768px) {
    .todos-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .filter-tabs {
        flex-direction: column;
    }
    
    .filter-tab {
        text-align: center;
    }
    
    .todo-item {
        padding: 1rem;
    }
    
    .todo-actions {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .todo-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.form-group input:disabled {
    background-color: var(--background);
    cursor: not-allowed;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

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

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

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

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--surface);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
}

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

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

.modal form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #dcfce7;
    color: #14532d;
    border: 1px solid #86efac;
}

.alert-error {
    background-color: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fca5a5;
}

/* Footer */
footer {
    background-color: var(--surface);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    text-align: center;
}

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

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        position: static;
    }
    
    .sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .feature-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .cta-buttons {
        flex-direction: column;
    }
    
    .hero h2 {
        font-size: 2rem;
    }
}