/* Templates Section Styles */

/* Template Section Container */
.template-section {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.template-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.template-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.template-see-all {
    font-size: 0.9rem;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.2s ease;
}

.template-see-all:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Template Filter Tabs */
.template-filter-tabs {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    overflow-x: auto;
    padding-bottom: var(--spacing-xs);
}

.template-filter-tab {
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 8px 16px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    color: var(--text-secondary);
}

.template-filter-tab:hover {
    border-color: var(--primary-light);
    background: rgba(200, 90, 58, 0.05);
}

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

/* Template Grid */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--spacing-md);
}

.template-grid.compact {
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
    .template-grid.compact {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Template Card */
.template-card {
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    position: relative;
}

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

.template-card.practiced {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05) 0%, rgba(76, 175, 80, 0.02) 100%);
    border-color: rgba(76, 175, 80, 0.3);
}

.template-card.practiced::after {
    content: '';
    position: absolute;
    top: 12px;
    right: 12px;
    width: 20px;
    height: 20px;
    background: #4CAF50;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-card.practiced::before {
    content: '';
    position: absolute;
    top: 16px;
    right: 16px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    z-index: 1;
}

.template-card-icon {
    font-size: 2rem;
    margin-bottom: var(--spacing-sm);
    line-height: 1;
}

.template-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
    flex: 1;
}

.template-card-category {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.template-card-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    align-self: flex-start;
}

.template-card-badge.beginner {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
}

.template-card-badge.intermediate {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}

.template-card-badge.advanced {
    background: rgba(200, 90, 58, 0.15);
    color: var(--primary-color);
}

/* Template Modal */
.template-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    animation: fadeIn 0.3s ease;
}

.template-modal-overlay.hidden {
    display: none;
}

.template-modal {
    width: 100%;
    max-width: 500px;
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideUpScale 0.3s ease-out;
    overflow: hidden;
}

.template-modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: var(--spacing-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
}

.template-modal-icon {
    font-size: 3rem;
    line-height: 1;
}

.template-modal-title-section {
    flex: 1;
}

.template-modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--spacing-xs) 0;
}

.template-modal-meta {
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
}

.template-modal-category {
    font-size: 0.85rem;
    opacity: 0.9;
}

.template-modal-badge {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.template-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: white;
}

.template-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.template-modal-close svg {
    width: 20px;
    height: 20px;
}

.template-modal-body {
    padding: var(--spacing-xl);
}

.template-modal-description {
    font-size: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: var(--spacing-lg);
}

.template-modal-section {
    margin-bottom: var(--spacing-lg);
}

.template-modal-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.template-modal-vocab {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.template-vocab-tag {
    background: linear-gradient(135deg, rgba(200, 90, 58, 0.1) 0%, rgba(232, 114, 90, 0.1) 100%);
    border: 1px solid rgba(200, 90, 58, 0.2);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 500;
}

.template-modal-goals {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.template-goal-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.9rem;
    color: var(--text-primary);
}

.template-goal-item::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
}

.template-start-btn {
    width: 100%;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: var(--spacing-md) var(--spacing-lg);
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    transition: all 0.2s ease;
}

.template-start-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.template-start-btn svg {
    width: 20px;
    height: 20px;
}

/* Template Full Panel (See All view) */
.template-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
}

.template-panel.hidden {
    display: none;
}

.template-panel-container {
    width: 100%;
    max-width: 1000px;
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideUpScale 0.3s ease-out;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.template-panel-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: var(--spacing-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.template-panel-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
}

.template-panel-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: white;
}

.template-panel-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.template-panel-close svg {
    width: 20px;
    height: 20px;
}

.template-panel-content {
    padding: var(--spacing-xl);
    overflow-y: auto;
    flex: 1;
}

.template-panel-filters {
    margin-bottom: var(--spacing-lg);
}

.template-panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

/* Loading State */
.template-loading {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.template-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: var(--spacing-md);
}

/* Empty State */
.template-empty {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.template-empty-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.template-empty-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.template-empty-message {
    font-size: 1rem;
    line-height: 1.6;
}

/* Template Progress Indicator */
.template-progress-bar {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, rgba(200, 90, 58, 0.05) 0%, rgba(232, 114, 90, 0.05) 100%);
    border: 2px solid rgba(200, 90, 58, 0.15);
    border-radius: var(--border-radius);
}

.template-progress-stat {
    flex: 1;
    text-align: center;
}

.template-progress-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.template-progress-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Template Card Progression Dots */
.template-card-progression {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: auto;
    padding-top: 12px;
}

.progression-stage {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #e0e0e0;
    border: 2px solid #e0e0e0;
    position: relative;
    transition: all 0.3s ease;
}

.progression-stage:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 2px;
    background: #e0e0e0;
}

.progression-stage.completed {
    background: #4CAF50;
    border-color: #4CAF50;
}

.progression-stage.completed::after {
    background: #4CAF50;
}

.progression-stage.current {
    background: #C85A3A;
    border-color: #C85A3A;
    box-shadow: 0 0 0 3px rgba(200, 90, 58, 0.2);
}

.progression-stage.unlocked {
    background: transparent;
    border-color: #C85A3A;
}

.progression-stage.locked {
    background: transparent;
    border-color: #e0e0e0;
    opacity: 0.6;
}

/* Stage Selection Modal */
.stage-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    animation: fadeIn 0.3s ease;
}

.stage-modal-overlay.hidden {
    display: none;
}

.stage-modal {
    width: 100%;
    max-width: 450px;
    background: var(--surface);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    animation: slideUpScale 0.3s ease-out;
    overflow: hidden;
}

.stage-modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: var(--spacing-xl);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.stage-modal-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.stage-modal-title-section {
    flex: 1;
}

.stage-modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.stage-modal-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    margin: 4px 0 0 0;
}

.stage-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: white;
}

.stage-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.stage-modal-body {
    padding: var(--spacing-xl);
}

/* Stage List */
.stage-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}

.stage-loading,
.stage-empty,
.stage-error {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.stage-error {
    color: #f44336;
}

/* Stage Card */
.stage-card {
    position: relative;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-md);
    transition: all 0.3s ease;
    animation: stageSlideIn 0.3s ease-out forwards;
    opacity: 0;
    transform: translateX(-20px);
}

@keyframes stageSlideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.stage-card.clickable {
    cursor: pointer;
}

.stage-card.clickable:hover {
    transform: translateX(4px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

/* Stage connector line */
.stage-connector {
    position: absolute;
    left: 24px;
    bottom: -20px;
    width: 2px;
    height: 20px;
    background: #e0e0e0;
    z-index: 1;
}

.stage-card.completed .stage-connector {
    background: #4CAF50;
}

/* Unlocked stage styling */
.stage-card.unlocked {
    border-color: var(--primary-color);
    border-style: solid;
}

.stage-card.unlocked .stage-number {
    color: var(--primary-color);
}

/* Completed stage styling */
.stage-card.completed {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.08) 0%, rgba(76, 175, 80, 0.02) 100%);
    border-color: #4CAF50;
}

.stage-card.completed .stage-number {
    color: #4CAF50;
}

.stage-card.completed .stage-status-icon {
    color: #4CAF50;
    font-weight: bold;
}

/* Locked stage styling */
.stage-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.stage-card.locked .stage-status-icon {
    color: var(--text-secondary);
}

.stage-number {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

.stage-card-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stage-card-header {
    flex: 1;
}

.stage-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--spacing-xs) 0;
}

.stage-status-icon {
    font-size: 1.25rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Stage difficulty badge */
.stage-difficulty-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stage-difficulty-badge.beginner {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
}

.stage-difficulty-badge.intermediate {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}

.stage-difficulty-badge.advanced {
    background: rgba(200, 90, 58, 0.15);
    color: var(--primary-color);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .template-section {
        padding: var(--spacing-md);
    }

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

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

    .template-card {
        min-height: 120px;
        padding: var(--spacing-md);
    }

    .template-card-icon {
        font-size: 1.5rem;
    }

    .template-card-title {
        font-size: 0.9rem;
    }

    .template-filter-tabs {
        gap: var(--spacing-xs);
    }

    .template-filter-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .template-modal {
        margin: var(--spacing-md);
    }

    .template-modal-header {
        padding: var(--spacing-lg);
    }

    .template-modal-icon {
        font-size: 2.5rem;
    }

    .template-modal-title {
        font-size: 1.25rem;
    }

    .template-panel-container {
        max-height: 100vh;
        border-radius: 0;
    }

    .template-panel {
        padding: 0;
    }

    .stage-modal {
        margin: var(--spacing-md);
        max-width: 100%;
    }

    .stage-modal-header {
        padding: var(--spacing-lg);
    }

    .stage-modal-icon {
        font-size: 2rem;
    }

    .stage-card {
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .stage-card-title {
        font-size: 0.9rem;
    }
}
