:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark: #1f2937;
    --light: #f9fafb;
    --border: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--dark);
}

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

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
}

.header-content h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Sections */
.section {
    margin-bottom: 30px;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.5s ease-in;
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

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

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.form-group label i {
    color: var(--primary-color);
    margin-right: 5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

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

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

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

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

.loading p {
    color: var(--dark);
    font-size: 1.1rem;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

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

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background: var(--light);
}

/* Schedule Cards */
.day-schedule {
    margin-bottom: 30px;
}

.day-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 1.3rem;
    font-weight: 600;
}

.session-card {
    background: var(--light);
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: 8px;
    transition: transform 0.3s;
}

.session-card:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.session-time {
    color: var(--warning-color);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 8px;
}

.session-topic {
    color: var(--success-color);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.session-description {
    color: #6b7280;
    font-style: italic;
    margin-bottom: 15px;
}

.session-activities {
    margin: 15px 0;
}

.session-activities h4 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.session-activities ul {
    list-style: none;
    padding-left: 0;
}

.session-activities li {
    padding: 5px 0;
    padding-left: 25px;
    position: relative;
}

.session-activities li:before {
    content: "•";
    color: var(--primary-color);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.session-outcome {
    background: #e0f2fe;
    border-left: 3px solid var(--primary-color);
    padding: 10px 15px;
    margin-top: 15px;
    border-radius: 4px;
}

.session-outcome strong {
    color: var(--secondary-color);
}

/* Content Box */
.content-box {
    background: var(--light);
    padding: 20px;
    border-radius: 8px;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Info Card */
.info-card {
    background: linear-gradient(135deg, #8195ee 0%, #a86de3 100%);
    color: white;
}

.info-card h3 {
    color: white;
    margin-bottom: 15px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.metric-item {
    background: var(--light);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.metric-label {
    font-weight: 600;
    color: var(--dark);
}

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

.metric-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.metric-status.success {
    background: #d1fae5;
    color: var(--success-color);
}

.metric-status.failed {
    background: #fee2e2;
    color: var(--danger-color);
}

/* Utilities */
.hidden {
    display: none;
}

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

/* Responsive */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 20px;
    }
}


/* Markdown Content Formatting */
.content-box {
    background: var(--light);
    padding: 20px;
    border-radius: 8px;
    line-height: 1.8;
}

.content-box h1,
.content-box h2,
.content-box h3 {
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 10px;
}

.content-box h1 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.content-box h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.content-box h3 {
    font-size: 1.3rem;
    color: var(--secondary-color);
}

.content-box p {
    margin-bottom: 15px;
    color: var(--dark);
}

.content-box ul,
.content-box ol {
    margin: 15px 0;
    padding-left: 30px;
}

.content-box li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.content-box ul {
    list-style-type: disc;
}

.content-box ul ul {
    list-style-type: circle;
    margin-top: 10px;
}

.content-box ul ul ul {
    list-style-type: square;
}

.content-box code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #e74c3c;
    font-size: 0.9em;
}

.content-box pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 15px 0;
}

.content-box pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.content-box blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 20px;
    margin: 15px 0;
    font-style: italic;
    color: #6b7280;
    background: #f9fafb;
    padding: 15px 20px;
    border-radius: 0 8px 8px 0;
}

.content-box strong,
.content-box b {
    color: var(--primary-color);
    font-weight: 600;
}

.content-box em,
.content-box i {
    color: var(--secondary-color);
}

.content-box hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 25px 0;
}

.content-box a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid var(--primary-color);
    transition: color 0.3s;
}

.content-box a:hover {
    color: var(--secondary-color);
    border-bottom-color: var(--secondary-color);
}

/* Resources Specific Styling */
.resource-item {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.resource-item:hover {
    transform: translateX(5px);
}

.resource-title {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.resource-link {
    color: var(--success-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 10px;
}

.resource-link:hover {
    text-decoration: underline;
}

.resource-description {
    color: #6b7280;
    font-size: 0.95rem;
}

/* Notes Specific Styling */
.note-section {
    margin-bottom: 25px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--secondary-color);
}

.note-section h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

/* Better Typography */
.content-box {
    font-size: 1rem;
    color: #374151;
}

/* Nested Lists Styling */
.content-box ul li ul {
    margin-top: 8px;
    margin-bottom: 8px;
}

.content-box ul li ul li {
    font-size: 0.95rem;
}

/* Definition Lists */
.content-box dl {
    margin: 15px 0;
}

.content-box dt {
    font-weight: 600;
    color: var(--primary-color);
    margin-top: 10px;
}

.content-box dd {
    margin-left: 20px;
    margin-bottom: 10px;
    color: #6b7280;
}


/* Progress Tracking Styles */
.progress-overview {
    margin-bottom: 30px;
}

.progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 5px;
}

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

/* Progress Bar */
.progress-bar-container {
    margin-bottom: 25px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e5e7eb;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 15px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Topics Checklist */
.topics-checklist {
    margin-top: 20px;
}

.topic-item {
    background: var(--light);
    border-radius: 8px;
    padding: 15px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.topic-item:hover {
    background: white;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.topic-item.completed {
    background: #d1fae5;
    border-left: 4px solid var(--success-color);
}

.topic-checkbox {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.topic-item.completed .topic-checkbox {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.topic-checkbox i {
    display: none;
}

.topic-item.completed .topic-checkbox i {
    display: block;
}

.topic-info {
    flex: 1;
}

.topic-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
}

.topic-item.completed .topic-title {
    color: var(--success-color);
}

.topic-time {
    font-size: 0.85rem;
    color: #6b7280;
}

.topic-day-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.topic-item.completed .topic-day-badge {
    background: var(--success-color);
}

/* Completion Animation */
@keyframes checkmark {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.topic-item.completed .topic-checkbox i {
    animation: checkmark 0.4s ease;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--border);
}

/* Celebration Effect */
.celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    font-size: 4rem;
    animation: celebrate 1s ease;
    pointer-events: none;
}

@keyframes celebrate {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

/* Responsive Progress */
@media (max-width: 768px) {
    .progress-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}


/* User Section */
.user-card {
    background: linear-gradient(135deg, #7e96ff 0%, #9563c8 100%);
    color: white;
    text-align: center;
}

.user-card h3 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.user-input-container {
    display: flex;
    gap: 10px;
    /* allow more room for long names and ensure responsive behavior */
    max-width: 900px;
    width: 100%;
    margin: 0 auto 15px;
    align-items: center;
}

.user-input-container input {
    flex: 1 1 auto;
    min-width: 280px;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
}

.user-input-container .btn {
    /* prevent global .btn-primary width:100% from forcing wrapping here */
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
}

.user-hint {
    opacity: 0.9;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Sessions List */
.sessions-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.session-card-item {
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.session-card-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.session-card-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.session-title {
    font-weight: 600;
    color: var(--dark);
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.session-date {
    font-size: 0.85rem;
    color: #6b7280;
}

.session-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.session-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 15px;
}

.session-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #6b7280;
}

.session-detail i {
    color: var(--primary-color);
}

.session-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.session-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), #059669);
    transition: width 0.3s;
}

.session-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.session-progress-text {
    font-size: 0.9rem;
    color: var(--success-color);
    font-weight: 600;
}

.session-resume-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.3s;
}

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

.empty-sessions {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-sessions i {
    font-size: 4rem;
    margin-bottom: 20px;
    color: var(--border);
}

.empty-sessions h3 {
    margin-bottom: 10px;
    color: var(--dark);
}

/* Loading Spinner for History */
.loading-history {
    text-align: center;
    padding: 40px;
}

.loading-history .spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 15px;
}