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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #10b981;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --error: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --gradient-1: #6366f1;
    --gradient-2: #8b5cf6;
    --gradient-3: #d946ef;
    --sidebar-width: 280px;
}

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border);
}

[dir="rtl"] .main-wrapper {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .session-info {
    flex-direction: row-reverse;
}

[dir="rtl"] .day-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .task-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .file-item {
    flex-direction: row-reverse;
}

[dir="rtl"] .file-info {
    flex-direction: row-reverse;
}

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

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

[dir="rtl"] .sidebar.collapsed {
    transform: translateX(100%);
}

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

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-icon:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.sessions-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.session-item:hover {
    background: var(--surface-light);
}

.session-item.active {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid var(--primary);
}

.session-info-text {
    flex: 1;
    min-width: 0;
}

.session-title {
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.session-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0;
    transition: all 0.2s;
}

.session-item:hover .session-delete {
    opacity: 1;
}

.session-delete:hover {
    color: var(--error);
}

/* Main Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.sidebar.collapsed + .main-wrapper {
    margin-left: 0;
}

[dir="rtl"] .sidebar.collapsed + .main-wrapper {
    margin-right: 0;
}

/* Top Bar */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
}

.menu-toggle:hover {
    background: var(--surface-light);
}

.lang-switcher {
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--surface-light);
    color: var(--text-muted);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

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

.lang-btn:hover:not(.active) {
    background: var(--border);
    color: var(--text);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Main Header */
.main-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
}

.main-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2), var(--gradient-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Session Info */
.session-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

.session-name {
    font-weight: 600;
    color: var(--primary-light);
}

.btn-delete-session {
    background: none;
    border: 1px solid var(--error);
    color: var(--error);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-delete-session:hover {
    background: var(--error);
    color: white;
}

/* Upload Section */
.upload-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 2.5rem;
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid var(--border);
}

.upload-area {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-area h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.upload-text {
    color: var(--primary-light);
    cursor: pointer;
}

.file-types {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* File List */
.file-list {
    margin-top: 1.5rem;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-light);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
}

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

.file-icon {
    font-size: 1.5rem;
}

.file-name {
    font-weight: 500;
}

.file-size {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.file-remove {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    transition: transform 0.2s;
}

.file-remove:hover {
    transform: scale(1.1);
}

/* Inputs */
.deadline-section,
.hours-section {
    margin-top: 1.5rem;
}

.deadline-section label,
.hours-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="date"],
input[type="number"] {
    width: 100%;
    padding: 1rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

/* Buttons */
.generate-btn {
    width: 100%;
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

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

.btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    padding: 0.875rem 1.5rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Loading Section */
.loading-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 4rem;
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
    border: 1px solid var(--border);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--surface-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 1.5rem;
    animation: spin 1s linear infinite;
}

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

.loading-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.loading-card p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2));
    border-radius: 3px;
    transition: width 0.3s ease;
    animation: progress 3s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Results Section */
.results-section {
    animation: fadeIn 0.5s ease;
}

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

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

.results-header h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.plan-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.meta-item {
    background: var(--surface);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* Summary Card */
.summary-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.summary-card h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

#summaryContent {
    line-height: 1.8;
}

#summaryContent p {
    margin-bottom: 1rem;
}

#summaryContent ul {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

#summaryContent li {
    margin-bottom: 0.5rem;
}

/* Timeline */
.schedule-container h3 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.timeline {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.day-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.day-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--gradient-1), var(--gradient-2));
}

[dir="rtl"] .day-card::before {
    left: auto;
    right: 0;
}

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

.day-number {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-light);
}

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

.day-topics {
    margin-bottom: 1rem;
}

.day-topics h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.day-topics ul {
    list-style: none;
}

.day-topics li {
    padding: 0.35rem 0;
    padding-left: 1.25rem;
    position: relative;
}

[dir="rtl"] .day-topics li {
    padding-left: 0;
    padding-right: 1.25rem;
}

.day-topics li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--secondary);
}

[dir="rtl"] .day-topics li::before {
    left: auto;
    right: 0;
}

.day-tasks {
    background: var(--surface-light);
    border-radius: 12px;
    padding: 1rem;
}

.day-tasks h4 {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    cursor: pointer;
    transition: opacity 0.2s;
}

.task-item:hover {
    opacity: 0.8;
}

.task-item.completed {
    opacity: 0.5;
}

.task-item.completed .task-text {
    text-decoration: line-through;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary);
    border-radius: 5px;
    flex-shrink: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.task-checkbox:hover {
    background: rgba(99, 102, 241, 0.1);
}

.task-checkbox.checked {
    background: var(--secondary);
    border-color: var(--secondary);
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 12px;
}

.task-text {
    flex: 1;
}

.task-time {
    color: var(--primary-light);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Actions */
.actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

/* Error Section */
.error-card {
    background: var(--surface);
    border-radius: 24px;
    padding: 3rem;
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
    border: 1px solid var(--error);
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-card h3 {
    color: var(--error);
    margin-bottom: 1rem;
}

.error-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 4rem;
    padding: 2rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    [dir="rtl"] .main-wrapper {
        margin-right: 0;
    }
    
    .menu-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .main-header h1 {
        font-size: 1.75rem;
    }
    
    .upload-card {
        padding: 1.5rem;
    }
    
    .plan-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
    
    .top-bar {
        padding: 1rem;
    }
    
    .session-info {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }
}

/* Hidden utility */
[hidden] {
    display: none !important;
}
