/* Torvik Gruen Frontend Styles */
:root {
    --tg-primary: #22c55e;
    --tg-primary-dark: #16a34a;
    --tg-secondary: #f3f4f6;
    --tg-text: #111827;
    --tg-text-muted: #6b7280;
    --tg-border: #e5e7eb;
    --tg-radius: 8px;
}

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

/* Course Catalog */
.tg-course-catalog {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.tg-catalog-header {
    text-align: center;
    margin-bottom: 40px;
}

.tg-catalog-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--tg-text);
    margin-bottom: 16px;
}

.tg-catalog-subtitle {
    font-size: 1.2rem;
    color: var(--tg-text-muted);
    margin-bottom: 32px;
}

.tg-catalog-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
    align-items: center;
}

.tg-search-input {
    flex: 1;
    min-width: 300px;
    padding: 12px 16px;
    border: 2px solid var(--tg-border);
    border-radius: var(--tg-radius);
    font-size: 16px;
}

.tg-search-input:focus {
    outline: none;
    border-color: var(--tg-primary);
}

.tg-filter-select {
    padding: 12px 16px;
    border: 2px solid var(--tg-border);
    border-radius: var(--tg-radius);
    background: white;
    font-size: 16px;
    cursor: pointer;
}

.tg-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.tg-course-card {
    background: white;
    border: 1px solid var(--tg-border);
    border-radius: var(--tg-radius);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.tg-course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.tg-course-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.tg-course-content {
    padding: 20px;
}

.tg-course-category {
    display: inline-block;
    background: var(--tg-primary);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.tg-course-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--tg-text);
    margin-bottom: 8px;
    line-height: 1.4;
}

.tg-course-description {
    color: var(--tg-text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tg-course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tg-course-instructor {
    font-size: 14px;
    color: var(--tg-text-muted);
}

.tg-course-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: #fbbf24;
}

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

.tg-course-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tg-primary);
}

.tg-course-duration {
    font-size: 14px;
    color: var(--tg-text-muted);
}

.tg-btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--tg-radius);
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

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

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

.tg-btn-secondary {
    background: var(--tg-secondary);
    color: var(--tg-text);
    border: 1px solid var(--tg-border);
}

.tg-btn-secondary:hover {
    background: #e5e7eb;
    color: var(--tg-text);
}

/* User Dashboard */
.tg-dashboard {
    margin: 40px 0;
}

.tg-dashboard-header {
    background: linear-gradient(135deg, var(--tg-primary), var(--tg-primary-dark));
    color: white;
    padding: 40px;
    border-radius: var(--tg-radius);
    margin-bottom: 32px;
    text-align: center;
}

.tg-dashboard-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

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

.tg-dashboard-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 32px;
}

.tg-dashboard-main {
    min-height: 400px;
}

.tg-dashboard-sidebar {
    background: white;
    border: 1px solid var(--tg-border);
    border-radius: var(--tg-radius);
    padding: 24px;
    height: fit-content;
}

.tg-progress-card {
    background: white;
    border: 1px solid var(--tg-border);
    border-radius: var(--tg-radius);
    padding: 20px;
    margin-bottom: 20px;
}

.tg-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tg-progress-title {
    font-weight: 600;
    color: var(--tg-text);
}

.tg-progress-percentage {
    font-weight: 700;
    color: var(--tg-primary);
}

.tg-progress-bar {
    width: 100%;
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.tg-progress-fill {
    height: 100%;
    background: var(--tg-primary);
    transition: width 0.3s;
}

/* Course Player */
.tg-player {
    background: #000;
    color: white;
    min-height: 100vh;
}

.tg-player-container {
    display: flex;
    height: 100vh;
}

.tg-player-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tg-player-video {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tg-player-video video {
    width: 100%;
    height: 100%;
    max-height: 70vh;
}

.tg-player-info {
    padding: 20px;
    background: #1f2937;
}

.tg-lesson-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.tg-lesson-description {
    color: #d1d5db;
    margin-bottom: 16px;
}

.tg-player-controls {
    display: flex;
    gap: 12px;
}

.tg-player-sidebar {
    width: 350px;
    background: #374151;
    border-left: 1px solid #4b5563;
    overflow-y: auto;
}

.tg-lessons-list {
    padding: 20px;
}

.tg-lesson-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.tg-lesson-item:hover {
    background: #4b5563;
}

.tg-lesson-item.active {
    background: var(--tg-primary);
}

.tg-lesson-number {
    width: 32px;
    height: 32px;
    background: #6b7280;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 12px;
    flex-shrink: 0;
}

.tg-lesson-item.completed .tg-lesson-number {
    background: var(--tg-primary);
}

.tg-lesson-details h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
}

.tg-lesson-duration {
    font-size: 12px;
    color: #d1d5db;
}

/* Responsive */
@media (max-width: 768px) {
    .tg-catalog-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tg-search-input {
        min-width: auto;
    }
    
    .tg-courses-grid {
        grid-template-columns: 1fr;
    }
    
    .tg-dashboard-content {
        grid-template-columns: 1fr;
    }
    
    .tg-player-container {
        flex-direction: column;
    }
    
    .tg-player-sidebar {
        width: 100%;
        height: 300px;
    }
}

/* Loading and Error States */
.tg-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--tg-text-muted);
}

.tg-loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f4f6;
    border-radius: 50%;
    border-top-color: var(--tg-primary);
    animation: spin 1s ease-in-out infinite;
    margin-right: 12px;
}

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

.tg-error {
    background: #fef2f2;
    color: #991b1b;
    padding: 16px;
    border-radius: var(--tg-radius);
    border: 1px solid #fecaca;
    margin: 20px 0;
}

.tg-login-required {
    text-align: center;
    padding: 40px;
    background: white;
    border: 1px solid var(--tg-border);
    border-radius: var(--tg-radius);
}

/* Quiz Styles */
.tg-quiz {
    background: white;
    border: 1px solid var(--tg-border);
    border-radius: var(--tg-radius);
    padding: 24px;
    margin: 20px 0;
}

.tg-quiz-question {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--tg-text);
}

.tg-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.tg-quiz-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid var(--tg-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.tg-quiz-option:hover {
    border-color: var(--tg-primary);
    background: #f0fdf4;
}

.tg-quiz-option.selected {
    border-color: var(--tg-primary);
    background: #f0fdf4;
}

.tg-quiz-option input[type="radio"] {
    margin-right: 12px;
}

.tg-quiz-explanation {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 16px;
    margin-top: 16px;
    color: #166534;
}