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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #f9fafb;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    padding-bottom: 2rem;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* Header */
header {
    background: var(--primary);
    color: white;
    padding: 1.5rem 1rem 1rem;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.today-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    opacity: 0.95;
}

.cycle-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 600;
}

/* Navigation Tabs */
.tabs {
    display: flex;
    background: white;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

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

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

/* Tab Content */
.tab-content {
    display: none;
    padding: 1rem;
}

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

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

.section-header h2 {
    font-size: 1.25rem;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}

.card h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text);
}

/* Homework Item */
.homework-item {
    background: var(--card-bg);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.homework-item.done {
    opacity: 0.6;
    border-left-color: var(--success);
}

.homework-item.hard {
    border-left-color: var(--danger);
}

.homework-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.homework-title {
    font-weight: 600;
    font-size: 1rem;
}

.homework-subject {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.homework-due {
    font-size: 0.75rem;
    color: var(--warning);
    font-weight: 500;
}

.homework-due.overdue {
    color: var(--danger);
}

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

.homework-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Class Item */
.class-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.class-item:last-child {
    border-bottom: none;
}

.class-time {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.class-name {
    font-weight: 600;
    margin-top: 0.25rem;
}

.class-teacher {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-small {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

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

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

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

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

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

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

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 1.25rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0;
    width: 2rem;
    height: 2rem;
}

/* Form */
form {
    padding: 1.5rem;
}

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

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

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

.form-group textarea {
    resize: vertical;
}

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

.difficulty-btn {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border);
    background: white;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.difficulty-btn.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.modal-actions button {
    flex: 1;
}

/* States */
.loading, .empty-state, .error-state {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

.error-state {
    color: var(--danger);
}

/* Mobile optimizations */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.25rem;
    }
    
    .modal-content {
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }
}
