/* styles.css - Stilmallar för "Introduktion till generativ AI" */

/* 
 * MOBILANPASSNINGAR AV VISUALISERINGSSEKTIONEN (2023-10-15)
 * ------------------------------------------------------
 * Följande förbättringar har implementerats för att göra "Visualisering"-fliken 
 * mer användarvänlig på mobila enheter utan att påverka utseendet på datorer:
 *
 * 1. Lagt till flex-shrink: 0 på stegnummer för att förhindra att de krymper på små skärmar
 * 2. Gjort tabeller horisontellt scrollbara med overflow-x: auto på mobil
 * 3. Anpassat textstorlekar för bättre läsbarhet på små skärmar
 * 4. Förbättrat stapeldiagram med minsta bredd på staplar för bättre synlighet
 * 5. Justerat padding och marginaler i processdiagram för effektivare platsutnyttjande
 * 6. Lagt till särskilda optimeringar för mycket små skärmar (under 480px)
 *
 * Dessa ändringar påverkar endast mobila gränssnitt genom CSS media queries.
 */

/* Grundläggande stilar och reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    padding-bottom: 40px;
}

/* Rubrikstil */
h1, h2, h3, h4, h5, h6 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

p {
    margin-bottom: 1rem;
}

/* Header */
header {
    background-color: #3498db;
    background-image: linear-gradient(to right, #3498db, #2980b9);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

header h1 {
    color: white;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Huvudinnehåll */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Fliknavigering */
.tabs {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    gap: 5px;
    justify-content: center;
}

.tab-button, .description-button {
    background-color: #ecf0f1;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    border-radius: 4px;
    font-weight: 500;
}

.tab-button:hover, .description-button:hover {
    background-color: #3498db;
    color: white;
}

.tab-button.active {
    background-color: #3498db;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.tab-button.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.description-button {
    background-color: #2ecc71;
    color: white;
    margin-left: auto;
}

/* Innehållsområde */
.tab-content {
    display: none;
    margin-bottom: 2rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

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

.tab-content h2 {
    background-color: #f8f9fa;
    padding: 1.2rem;
    border-bottom: 1px solid #e9ecef;
    font-size: 1.5rem;
}

.content {
    padding: 1.5rem;
}

/* Tips-sidan */
.tip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 1.5rem;
}

.tip {
    flex: 1 1 300px;
    background-color: #f8f9fa;
    padding: 1.2rem;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.tip h4 {
    margin-bottom: 0.8rem;
    color: #3498db;
}

/* Visualisering */
.visual-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 1.5rem;
}

.visual-item {
    flex: 1 1 400px;
    margin-bottom: 1.5rem;
}

.process-diagram {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
}

.process-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 15px;
}

.step-number {
    background-color: #3498db;
    color: white;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-right: 15px;
    font-weight: bold;
    flex-shrink: 0; /* Förhindrar att stegnumren krymper på mobila skärmar, vilket bevarar den visuella tydligheten */
}

.step-content {
    flex: 1;
}

.arrow {
    text-align: center;
    font-size: 1.5rem;
    color: #95a5a6;
    margin: 10px 0;
}

/* Tabell stil */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.comparison-table th, .comparison-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.comparison-table th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 500;
}

.comparison-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Graf stil */
.applications-chart {
    margin-top: 20px;
}

.chart-bar {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.bar-label {
    width: 150px;
    text-align: right;
    padding-right: 15px;
    font-weight: 500;
}

.bar-value {
    height: 30px;
    background-color: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 10px;
    border-radius: 4px;
    font-weight: 500;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
}

.chart-info {
    margin-top: 10px;
    color: #7f8c8d;
    font-size: 0.9rem;
    text-align: right;
}

/* Quiz */
.quiz-container {
    max-width: 800px;
    margin: 0 auto;
}

.quiz-question {
    background-color: #f8f9fa;
    padding: 1.2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #f39c12;
}

.quiz-options {
    margin-top: 1rem;
}

.option {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 4px;
    background-color: white;
    transition: background-color 0.2s;
}

.option:hover {
    background-color: #ecf0f1;
}

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

.feedback {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
    display: none;
}

.feedback.correct {
    background-color: #e8f5e9;
    color: #2e7d32;
    display: block;
}

.feedback.incorrect {
    background-color: #ffebee;
    color: #c62828;
    display: block;
}

.quiz-button {
    background-color: #f39c12;
    color: white;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 4px;
    display: block;
    margin: 20px auto;
    transition: background-color 0.3s;
}

.quiz-button:hover {
    background-color: #e67e22;
}

/* Lösning */
.locked-content {
    text-align: center;
    padding: 3rem 1rem;
}

.locked-icon {
    max-width: 100px;
    margin: 2rem auto;
    opacity: 0.7;
}

.solution-step {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.usage-area, .implication {
    background-color: #f8f9fa;
    padding: 1.2rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.usage-area h5, .implication h5 {
    color: #3498db;
    margin-bottom: 0.8rem;
}

/* Programbeskrivning */
.description-content {
    display: none;
    padding: 2rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
}

.description-section {
    margin-bottom: 2rem;
}

pre.structure {
    background-color: #f8f9fa;
    padding: 1.2rem;
    border-radius: 8px;
    font-family: monospace;
    white-space: pre;
    overflow-x: auto;
    margin: 1rem 0;
    line-height: 1.4;
}

#backToApp {
    margin-top: 2rem;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
    width: 100%;
}

/* Responsiv design */
@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }
    
    .tip-container, .visual-container {
        flex-direction: column;
    }
    
    .chart-bar {
        flex-wrap: wrap;
    }
    
    .bar-label {
        width: 100%;
        text-align: left;
        margin-bottom: 5px;
    }
    
    /* Mobilanpassningar för visualiseringssektionen */
    /* OBS: Förbättrad mobillayout som behåller samma strukturella layout som desktop-versionen */
    .visual-item {
        flex: 1 1 100%;
    }
    
    /* Hantera tabellöverflöd på mobil */
    /* Gör tabeller horisontellt scrollbara istället för att förminska dem till oläsbarhet */
    .visual-item .comparison-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        font-size: 0.9rem;
    }
    
    /* Förbättra diagram på mobil */
    /* Förhindrar att stapeldiagram skapar horisontell scrollning på små skärmar */
    .applications-chart {
        overflow-x: hidden;
    }
    
    /* Säkerställer att procenttal alltid syns tydligt även på smala staplar */
    .bar-value {
        min-width: 40px;
    }
    
    /* Gör processdiagrammet tydligare på mobil */
    /* Minskar padding men behåller läsbarhet och visuell struktur */
    .process-diagram {
        padding: 0.75rem;
    }
    
    .process-step {
        margin-bottom: 12px;
    }
    
    .step-content h5 {
        font-size: 0.95rem;
    }
}

/* För mycket små skärmar */
/* Ytterligare optimeringar för skärmar mindre än 480px för att maximera läsbarhet */
@media (max-width: 480px) {
    .content {
        padding: 1rem;
    }
    
    /* Mindre padding och textstorlek i tabeller gör dem mer läsliga på små skärmar utan att ändra innehållet */
    .visual-item .comparison-table th,
    .visual-item .comparison-table td {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
    
    .chart-info {
        font-size: 0.8rem;
    }
    
    /* Optimerar processvisualisering för minimala skärmar */
    .process-step {
        margin-bottom: 10px;
    }
    
    .step-content p {
        font-size: 0.9rem;
    }
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tab-content.active {
    animation: fadeIn 0.3s ease-in;
} 