/* anpassa_lektion.css - Snälla AI-Skolan */
/* Utvecklad av Kristian Snäll */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    display: flex;
}

/* =================================================================
   SIDEBAR STYLING
   ================================================================= */

.sidebar {
    width: 280px;
    background: white;
    box-shadow: 2px 0 15px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

.logo-section {
    padding: 25px 20px;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
}

.logo h1 {
    font-size: 1.3em;
    color: white;
    font-weight: 600;
}

.nav-menu {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s ease;
    border-radius: 0 25px 25px 0;
    margin: 3px 0;
    font-weight: 500;
}

.nav-item:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #333;
    transform: translateX(5px);
}

.nav-item.active {
    background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
    color: #be185d;
    border-left: 4px solid #ec4899;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.2);
}

.nav-icon {
    font-size: 1.3em;
}

.bottom-section {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.ai-tip {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    padding: 15px;
    border-radius: 12px;
    font-size: 0.85em;
    color: #155724;
    text-align: center;
    border: 1px solid #c3e6cb;
}

/* =================================================================
   MAIN CONTENT STYLING
   ================================================================= */

.main-content {
    margin-left: 280px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.header {
    background: white;
    padding: 25px 30px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.header h2 {
    font-size: 2em;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 10px 15px;
    border-radius: 25px;
    font-size: 0.9em;
    color: #666;
}

.lesson-container {
    flex: 1;
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* =================================================================
   INTRO SECTION
   ================================================================= */

.lesson-intro {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: white;
    padding: 40px;
    border-radius: 25px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(168, 237, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.lesson-intro::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: float 6s ease-in-out infinite;
}

.lesson-intro h3 {
    font-size: 2.5em;
    margin-bottom: 15px;
    font-weight: 300;
    position: relative;
    z-index: 1;
}

.lesson-intro p {
    font-size: 1.2em;
    opacity: 0.95;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

/* =================================================================
   TEMPLATES SECTION
   ================================================================= */

.templates-section {
    margin-bottom: 40px;
}

.templates-title {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.6em;
    color: #2c3e50;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.template-card {
    background: white;
    padding: 25px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 2px solid transparent;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.template-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.template-card:hover::before {
    left: 100%;
}

.template-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: #a8edea;
    box-shadow: 0 15px 35px rgba(168, 237, 234, 0.4);
}

.template-card .icon {
    font-size: 3em;
    margin-bottom: 15px;
    display: block;
    transition: transform 0.3s ease;
}

.template-card:hover .icon {
    transform: scale(1.1) rotate(5deg);
}

.template-card h4 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 1.2em;
    font-weight: 600;
}

.template-card p {
    color: #666;
    font-size: 0.95em;
    line-height: 1.5;
    margin-bottom: 10px;
}

.template-card .lgr22-ref {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    padding: 6px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    color: #1976d2;
    font-weight: 500;
    margin-top: 8px;
    display: inline-block;
}

/* Färgkodning för olika ämnesområden */
.matematik { border-left: 4px solid #ff6b6b; }
.svenska { border-left: 4px solid #4ecdc4; }
.naturkunskap { border-left: 4px solid #45b7d1; }
.samhallskunskap { border-left: 4px solid #f39c12; }
.engelska { border-left: 4px solid #9b59b6; }
.specialbehov { border-left: 4px solid #e74c3c; }
.digitalt { border-left: 4px solid #34495e; }

/* =================================================================
   FORM SECTION
   ================================================================= */

.form-section {
    background: white;
    padding: 35px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 25px;
    border: 1px solid #f0f0f0;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
    position: relative;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c3e50;
    font-size: 1em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 15px;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: 1em;
    outline: none;
    transition: all 0.3s ease;
    font-family: inherit;
    background: #fafafa;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #a8edea;
    background: white;
    box-shadow: 0 0 0 3px rgba(168, 237, 234, 0.1);
    transform: translateY(-2px);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
}

/* =================================================================
   SPECIAL NEEDS SECTION
   ================================================================= */

.special-needs {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    border: 1px solid #dee2e6;
}

.special-needs h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
}

.needs-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.need-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.need-option:hover {
    border-color: #a8edea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(168, 237, 234, 0.2);
}

.need-option.selected {
    border-color: #a8edea;
    background: linear-gradient(135deg, #f0fdfa 0%, #e6fffa 100%);
    box-shadow: 0 4px 15px rgba(168, 237, 234, 0.3);
}

.need-option input[type="checkbox"] {
    margin: 0;
    width: 18px;
    height: 18px;
}

/* =================================================================
   BUTTONS
   ================================================================= */

.create-lesson-btn {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 50px;
    font-size: 1.3em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 8px 25px rgba(168, 237, 234, 0.3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.create-lesson-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(168, 237, 234, 0.5);
}

.create-lesson-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.copy-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

/* =================================================================
   LESSON AREA
   ================================================================= */

.lesson-area {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    padding: 30px;
    min-height: 350px;
    max-height: 700px;
    overflow-y: auto;
    line-height: 1.7;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.lesson-area.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    font-style: italic;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.response-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.response-title {
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2em;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.copy-btn {
    background: #667eea;
    color: white;
}

.copy-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.print-btn {
    background: #48c774;
    color: white;
}

.print-btn:hover {
    background: #3ead63;
    transform: translateY(-2px);
}

.hamburger {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10001;
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
}

.overlay.active {
    display: block;
}

.sidebar.active {
    transform: translateX(0) !important;
}

.success-response {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 5px solid #a8edea;
    padding: 25px;
    border-radius: 0 15px 15px 0;
    white-space: pre-wrap;
    font-size: 1.05em;
    line-height: 1.8;
}

/* =================================================================
   LOADING & ERROR STATES
   ================================================================= */

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    color: #a8edea;
    font-weight: 600;
    text-align: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e0e6ed;
    border-top: 4px solid #a8edea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.progress-steps {
    display: flex;
    justify-content: center;
    margin-top: 15px;
    gap: 8px;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e0e6ed;
    animation: pulse 1.5s infinite;
}

.progress-dot:nth-child(1) { animation-delay: 0s; }
.progress-dot:nth-child(2) { animation-delay: 0.3s; }
.progress-dot:nth-child(3) { animation-delay: 0.6s; }

.error {
    color: #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #f5c6cb;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

/* =================================================================
   FLOATING HELP BUTTON
   ================================================================= */

.floating-help {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    font-size: 1.5em;
}

.floating-help:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.6);
}

/* =================================================================
   ANIMATIONS
   ================================================================= */

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 70%, 100% { background: #e0e6ed; }
    35% { background: #a8edea; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* =================================================================
   RESPONSIVE DESIGN
   ================================================================= */

@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 10000;
    }

    .main-content {
        margin-left: 0;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .lesson-container {
        padding: 20px 15px;
    }

    .templates-grid {
        grid-template-columns: 1fr;
    }

    .needs-options {
        grid-template-columns: 1fr;
    }

    .lesson-intro h3 {
        font-size: 2em;
    }

    .header h2 {
        font-size: 1.5em;
    }

    .floating-help {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .lesson-container {
        padding: 15px 10px;
    }

    .form-section {
        padding: 20px;
    }

    .lesson-intro {
        padding: 25px;
    }

    .template-card {
        padding: 20px;
    }

    .create-lesson-btn {
        font-size: 1.1em;
        padding: 15px 30px;
    }
}