/* ===================================
   LESSON 9 - SPECIFIC STYLES
   Cicli che Creano (base copiata dalla lezione 8)
   =================================== */

/* Importing base lesson styles */
@import url('../lezione-01/style.css');

/* HTML Structure Box - Lesson 2 specific additions */
.html-structure-box {
    background: #e3f2fd;
    border: 3px solid #2196f3;
    padding: 2rem;
    border-radius: 16px;
    margin: 2rem 0;
}

body.dark-theme .html-structure-box {
    background: #0d2d4a;
    border-color: #64b5f6;
}

.html-structure-box h3 {
    color: #1976d2;
    margin-bottom: 1rem;
}

body.dark-theme .html-structure-box h3 {
    color: #64b5f6;
}

.html-structure-box p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.id-reference {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
    border-left: 4px solid #2196f3;
}

body.dark-theme .id-reference {
    background: #1a1a1a;
}

.id-reference strong {
    display: block;
    margin-bottom: 0.75rem;
    color: #1976d2;
    font-size: 1.1rem;
}

body.dark-theme .id-reference strong {
    color: #64b5f6;
}

.id-reference ul {
    list-style: none;
    padding: 0;
}

.id-reference li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--bg-tertiary);
}

.id-reference li:last-child {
    border-bottom: none;
}

.id-reference code {
    background: #e3f2fd;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-family: var(--font-code);
    color: #1976d2;
    font-weight: 600;
    margin-right: 0.5rem;
}

body.dark-theme .id-reference code {
    background: #0d2d4a;
    color: #64b5f6;
}

.code-tag {
    color: #569cd6;
}

.code-attr {
    color: #9cdcfe;
}

/* Demo Container Specific */
.demo-display {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

body.dark-theme .demo-display {
    background: #2d2d2d;
}

/* Counter Display */
.counter-display {
    text-align: center;
    padding: 2rem;
    background: var(--gradient-primary);
    border-radius: 16px;
    color: white;
    margin-bottom: 2rem;
}

.counter-label {
    font-size: 1rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.counter-value {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    margin: 1rem 0;
    text-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.counter-sublabel {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.stat-box {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s;
}

body.dark-theme .stat-box {
    background: #1a1a1a;
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Code Peek */
.code-peek {
    background: #1e1e1e;
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1.5rem;
}

.code-peek h4 {
    color: #888;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.code-peek code {
    font-family: var(--font-code);
    font-size: 0.9rem;
    line-height: 1.6;
}

.code-number {
    color: #b5cea8;
}

/* Visual Box */
.visual-box {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    margin: 1.5rem 0;
}

.variable-visual {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.var-box {
    background: white;
    border: 3px solid var(--accent-primary);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s;
}

body.dark-theme .var-box {
    background: #1a1a1a;
}

.var-box:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.var-name {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
    font-family: var(--font-code);
}

.var-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent-primary);
    font-family: var(--font-code);
}

/* Why Box */
.why-box {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: white;
    padding: 2rem;
    border-radius: 16px;
    margin: 1.5rem 0;
}

.why-box h3 {
    color: white;
    margin-bottom: 1rem;
}

.why-box ol {
    padding-left: 1.5rem;
}

.why-box li {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

/* Comparison Table */
.comparison-table {
    margin: 2rem 0;
    overflow-x: auto;
}

.comparison-table h4 {
    margin-bottom: 1rem;
}

.comparison-table table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

body.dark-theme .comparison-table table {
    background: #2d2d2d;
}

.comparison-table th {
    background: var(--gradient-primary);
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 700;
}

.comparison-table td {
    padding: 1.5rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.comparison-table code {
    display: block;
    margin: 0.5rem 0;
    font-family: var(--font-code);
    font-size: 0.9rem;
}

.comparison-table small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-secondary);
}

/* Info Box */
.info-box {
    background: #d1f2eb;
    border-left: 4px solid #00d2a0;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
}

body.dark-theme .info-box {
    background: #003d2d;
    color: #00ffa5;
}

.info-box strong {
    display: block;
    margin-bottom: 0.5rem;
}

/* Rules Box */
.rules-box {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 2rem 0;
}

.rule-item {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    align-items: flex-start;
}

.rule-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.rule-item code {
    display: block;
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    font-family: var(--font-code);
}

.rule-item ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

/* Types Grid */
.types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.type-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 16px;
    text-align: center;
    transition: all 0.3s;
    border: 3px solid transparent;
}

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

.type-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.type-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--accent-primary);
}

.type-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.code-example-small {
    background: #1e1e1e;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.code-example-small pre {
    margin: 0;
}

.code-example-small code {
    font-family: var(--font-code);
    font-size: 0.85rem;
    line-height: 1.5;
    color: #d4d4d4;
}

.code-boolean {
    color: #569cd6;
}

.code-null {
    color: #569cd6;
}

/* Interactive Type Checker */
.interactive-type-checker {
    margin: 2rem 0;
}

.type-checker {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.type-input {
    padding: 1rem;
    font-size: 1.1rem;
    border: 2px solid var(--bg-tertiary);
    border-radius: 8px;
    font-family: var(--font-code);
    background: white;
    color: var(--text-primary);
}

body.dark-theme .type-input {
    background: #1a1a1a;
    border-color: #3d3d3d;
}

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

.check-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.check-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.type-result {
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-theme .type-result {
    background: #1a1a1a;
}

/* Calculator Demo */
.calculator-demo {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    margin: 2rem 0;
}

.calc-container {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

body.dark-theme .calc-container {
    background: #2d2d2d;
}

.calc-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.calc-input {
    padding: 1rem;
    font-size: 1.5rem;
    text-align: center;
    border: 3px solid var(--bg-tertiary);
    border-radius: 8px;
    font-weight: 700;
    font-family: var(--font-code);
}

body.dark-theme .calc-input {
    background: #1a1a1a;
    border-color: #3d3d3d;
    color: white;
}

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

.calc-operator {
    padding: 1rem;
    font-size: 1.1rem;
    border: 3px solid var(--bg-tertiary);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-weight: 600;
}

body.dark-theme .calc-operator {
    background: #1a1a1a;
    border-color: #3d3d3d;
    color: white;
}

.calc-btn {
    width: 100%;
    padding: 1.25rem;
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.calc-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-lg);
}

.calc-result {
    background: var(--gradient-sunset);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    margin-top: 1.5rem;
}

.result-label {
    display: block;
    color: white;
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 3rem;
    font-weight: 900;
    color: white;
    font-family: var(--font-code);
}

/* Display Box */
.display-box {
    background: var(--gradient-primary);
    color: white;
    padding: 3rem;
    border-radius: 16px;
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s;
}

/* Points Display */
.points-display {
    background: var(--gradient-primary);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 2rem;
}

.points-label {
    color: white;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.points-value {
    font-size: 6rem;
    font-weight: 900;
    color: white;
    line-height: 1;
    margin: 1rem 0;
    text-shadow: 0 5px 15px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.points-sublabel {
    color: white;
    font-size: 1rem;
    opacity: 0.8;
}

.exercise-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

/* Project Styles */
.project-display {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 2rem;
}

.main-counter {
    background: var(--gradient-primary);
    padding: 3rem;
    border-radius: 20px;
    text-align: center;
    margin-bottom: 2rem;
}

.counter-big-value {
    font-size: 7rem;
    font-weight: 900;
    color: white;
    line-height: 1;
    text-shadow: 0 6px 20px rgba(0,0,0,0.3);
    transition: all 0.5s;
}

.project-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

body.dark-theme .stat-card {
    background: #1a1a1a;
}

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

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-title {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 900;
    color: var(--accent-primary);
    font-family: var(--font-code);
}

.project-controls-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-weight: 600;
    font-size: 0.9rem;
}

.project-input {
    padding: 1rem;
    font-size: 1.2rem;
    text-align: center;
    border: 3px solid var(--bg-tertiary);
    border-radius: 8px;
    font-weight: 700;
    font-family: var(--font-code);
}

body.dark-theme .project-input {
    background: #1a1a1a;
    border-color: #3d3d3d;
    color: white;
}

.project-btn {
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.project-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

/* Key Concepts */
.key-concepts-box {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 16px;
    margin: 2rem 0;
}

.key-concepts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.concept-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid var(--accent-primary);
    transition: all 0.3s;
}

body.dark-theme .concept-card {
    background: #2d2d2d;
}

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

.concept-card h4 {
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}

.concept-card code {
    background: rgba(47, 125, 79, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: var(--font-code);
}

/* Responsive */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

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

    .calc-operator {
        text-align: center;
    }

    .counter-value {
        font-size: 3.5rem;
    }

    .counter-big-value {
        font-size: 4rem;
    }

    .points-value {
        font-size: 4rem;
    }

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

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

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

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

@media (max-width: 480px) {
    .project-stats {
        grid-template-columns: 1fr 1fr;
    }
}
/* ===================================
   LEZIONE 8 - ADDITIONAL STYLES
   =================================== */

/* Day Selector Demo */
.day-selector {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

body.dark-theme .day-selector {
    background: #2d2d2d;
}

.day-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.day-btn {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--bg-tertiary);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.day-btn:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}

.day-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--accent-primary);
}

.day-message {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Comparison Table */
.comparison-table-container {
    overflow-x: auto;
    margin: 2rem 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

body.dark-theme .comparison-table {
    background: #2d2d2d;
}

.comparison-table th {
    background: var(--gradient-primary);
    color: white;
    padding: 1.5rem;
    text-align: left;
    font-weight: 700;
}

.comparison-table td {
    padding: 1.5rem;
    border-bottom: 1px solid var(--bg-tertiary);
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

.comparison-table .pro {
    color: #55efc4;
    font-weight: 600;
}

.comparison-table .con {
    color: #ff7675;
    font-weight: 600;
}

/* Tab System */
.tab-system {
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

body.dark-theme .tab-system {
    background: #2d2d2d;
}

.tab-navigation {
    display: flex;
    border-bottom: 2px solid var(--bg-tertiary);
    background: var(--bg-secondary);
}

.tab-button {
    flex: 1;
    padding: 1.5rem;
    background: transparent;
    border: none;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    position: relative;
}

.tab-button:hover {
    background: rgba(47, 125, 79, 0.1);
}

.tab-button.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: white;
}

body.dark-theme .tab-button.active {
    background: #2d2d2d;
}

.tab-content {
    padding: 2rem;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s;
}

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

/* Profile Tabs Project */
.profile-tabs-container {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

body.dark-theme .profile-tabs-container {
    background: #2d2d2d;
}

.profile-header {
    background: var(--gradient-primary);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1rem;
}

.profile-name {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
}

.profile-role {
    font-size: 1.1rem;
    opacity: 0.9;
}

.profile-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--bg-tertiary);
}

.profile-tab {
    flex: 1;
    padding: 1.5rem;
    background: transparent;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 4px solid transparent;
}

.profile-tab:hover {
    background: rgba(47, 125, 79, 0.1);
}

.profile-tab.active {
    color: var(--accent-primary);
    border-bottom-color: var(--accent-primary);
    background: white;
}

body.dark-theme .profile-tab.active {
    background: #2d2d2d;
}

.profile-content {
    padding: 2rem;
}

.profile-panel {
    display: none;
}

.profile-panel.active {
    display: block;
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.info-grid {
    display: grid;
    gap: 1.5rem;
}

.info-item {
    display: flex;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.info-icon {
    font-size: 2rem;
    margin-right: 1rem;
}

.info-details {
    flex: 1;
}

.info-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

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

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.skill-card {
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    text-align: center;
}

.skill-level {
    margin-top: 1rem;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.skill-level-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 0.5s;
}

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

.settings-section h4 {
    margin-bottom: 1rem;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 1rem;
}

.setting-toggle {
    width: 60px;
    height: 30px;
    background: #dfe6e9;
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.setting-toggle.active {
    background: var(--accent-primary);
}

.setting-toggle-ball {
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: all 0.3s;
}

.setting-toggle.active .setting-toggle-ball {
    left: 33px;
}

/* Responsive */
@media (max-width: 768px) {
    .tab-navigation,
    .profile-tabs {
        flex-direction: column;
    }
    
    .tab-button,
    .profile-tab {
        border-bottom: 1px solid var(--bg-tertiary);
        border-left: 3px solid transparent;
    }
    
    .tab-button.active,
    .profile-tab.active {
        border-bottom-color: var(--bg-tertiary);
        border-left-color: var(--accent-primary);
    }
    
    .day-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ===================================
   LEZIONE 9 - COMPONENTI NUOVI
   =================================== */

/* Demo: generatore di quadrati */
.loop-demo { background: var(--bg-secondary); border-radius: 16px; padding: 1.5rem; }
.loop-demo-controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.loop-demo-controls label { font-weight: 600; color: var(--text-primary); }
.loop-demo-controls input[type="range"] { flex: 1; min-width: 160px; accent-color: #2f7d4f; }
.loop-demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: .5rem; min-height: 56px; }
.loop-square {
    aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center;
    color: #fff; font-weight: 700; font-family: var(--font-code); text-shadow: 0 1px 2px rgba(0,0,0,.45);
    animation: quadrato-entra .25s ease-out;
}
@keyframes quadrato-entra { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
.loop-demo-counter { margin-top: 1rem; font-weight: 600; color: var(--text-secondary); min-height: 1.5em; }

/* Le tre parti del for */
.for-parts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin: 1.5rem 0 2rem; }
.for-part { background: var(--bg-secondary); border-radius: 12px; padding: 1rem 1.2rem; border-top: 4px solid #2f7d4f; }
.for-part strong { display: block; margin: .5rem 0 .3rem; color: var(--text-primary); }
.for-part p { margin: 0; color: var(--text-secondary); font-size: .95rem; }
.for-part-code { font-family: var(--font-code); background: #1e1e1e; color: #e6e6e6; padding: .2rem .55rem; border-radius: 6px; font-size: .9rem; }

/* For al rallentatore */
.step-loop { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 760px) { .step-loop { grid-template-columns: 1fr; } }
.step-loop-code { background: #1e1e1e; color: #e6e6e6; border-radius: 12px; padding: 1rem 0; font-family: var(--font-code); font-size: .95rem; overflow-x: auto; }
.step-line { white-space: pre; padding: .2rem 1rem; border-left: 4px solid transparent; }
.step-line.evidenziato { background: rgba(85, 239, 196, .15); border-left-color: #55efc4; }
.step-part { border-radius: 4px; padding: 0 .15rem; }
.step-part.evidenziato { background: #fdcb6e; color: #1a1a1a; }
.step-part.evidenziato .code-keyword, .step-part.evidenziato .code-number { color: #1a1a1a; }
.step-var { font-family: var(--font-code); font-size: 1.4rem; background: var(--bg-secondary); border-radius: 10px; padding: .6rem 1rem; color: var(--text-primary); }
.step-console { background: #1e1e1e; color: #c9f7c9; border-radius: 10px; margin-top: .8rem; padding: .6rem 1rem; font-family: var(--font-code); min-height: 5.5rem; }
.step-console-title { color: #9aa4b5; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .3rem; }
.step-explain { margin: .8rem 0; min-height: 3em; color: var(--text-primary); }
.step-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }
.step-buttons button:disabled { opacity: .5; cursor: default; }

/* Dadi */
.dice-demo { background: var(--bg-secondary); border-radius: 16px; padding: 1.5rem; }
.dice-row { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1rem; font-size: 2.2rem; line-height: 1; min-height: 2.3rem; }
.dice { color: var(--text-primary); }
.dice-sei { color: #2f7d4f; transform: scale(1.25); }

/* Esercizio: tabellina */
.tab-box { background: var(--bg-primary); padding: 1.5rem; border-radius: 12px; box-shadow: var(--shadow-sm); }
.tab-box h3 { text-align: center; margin-top: 0; }
.tab-input-row { display: flex; gap: .75rem; flex-wrap: wrap; margin: 1rem 0; }
.tab-input-row input { flex: 1; min-width: 90px; padding: .8rem; border: 2px solid var(--bg-tertiary); border-radius: 8px; font-size: 1.3rem; text-align: center; background: var(--bg-primary); color: var(--text-primary); }
.tab-righe { display: grid; gap: .35rem; }
.riga-tab { padding: .55rem 1rem; border-radius: 8px; background: var(--bg-secondary); color: var(--text-primary); font-family: var(--font-code); font-size: 1.05rem; animation: quadrato-entra .2s ease-out; }
.riga-tab.pari { background: rgba(47, 125, 79, .18); border-left: 4px solid #2f7d4f; }

/* Progetto: galleria */
.gallery-app { background: var(--bg-secondary); border-radius: 16px; padding: 1.5rem; margin-bottom: 2rem; }
.gallery-filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.filtro { border: 2px solid var(--bg-tertiary); background: var(--bg-primary); color: var(--text-primary); border-radius: 999px; padding: .45rem 1rem; font: 600 .95rem var(--font-primary, inherit); cursor: pointer; }
.filtro:hover { border-color: #2f7d4f; }
.filtro.attivo { background: #2f7d4f; border-color: #2f7d4f; color: #fff; }
.gallery-count { margin: 1rem 0; font-weight: 700; color: var(--text-secondary); }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 1rem; min-height: 60px; }
.foto-card { background: var(--bg-primary); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-sm); border: 3px solid transparent; animation: quadrato-entra .25s ease-out; }
.foto-card.preferita { border-color: #f1c40f; }
.foto-immagine { aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 3rem; }
.foto-titolo { padding: .6rem .8rem; font-weight: 600; color: var(--text-primary); font-size: .95rem; }

@media (prefers-reduced-motion: reduce) {
    .loop-square, .riga-tab, .foto-card { animation: none; }
}
