/**
 * Tutorial Kit Montaggio - Dark Theme CSS
 * Design moderno e pulito con tema scuro
 */

/* ===========================
   Reset e Base
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colori Dark Theme */
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-card: #242424;
    --bg-hover: #2a2a2a;
    --bg-active: #333333;
    
    /* Testi */
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --text-muted: #707070;
    
    /* Colori accent */
    --accent-blue: #4a9eff;
    --accent-green: #4caf50;
    --accent-orange: #ff9800;
    --accent-red: #f44336;
    
    /* Bordi */
    --border-color: #333333;
    --border-light: #404040;
    
    /* Altri */
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --radius: 8px;
    --radius-lg: 12px;
    
    /* Font */
    --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

/* ===========================
   Body e Container
   =========================== */
body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.container.kit-viewer {
    max-width: 800px;
}

/* ===========================
   Header
   =========================== */
.header {
    background: var(--bg-secondary);
    padding: 20px 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
}

.header.compact {
    padding: 15px;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

.logo {
    margin-right: 15px;
}

.back-home {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px;
    border-radius: var(--radius);
    transition: all 0.3s;
}

.back-home:hover {
    background: var(--bg-hover);
    color: var(--accent-blue);
}

/* Language Switcher */
.language-switcher {
    display: flex;
    gap: 5px;
    background: var(--bg-card);
    padding: 3px;
    border-radius: var(--radius);
}

.language-switcher a {
    padding: 5px 10px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.language-switcher a:hover {
    color: var(--text-primary);
}

.language-switcher a.active {
    background: var(--accent-blue);
    color: white;
}

/* ===========================
   Main Content
   =========================== */
.main-content {
    flex: 1;
    padding: 0 15px;
}

.kit-content {
    flex: 1;
    padding: 0 15px 30px;
}

/* ===========================
   Cards
   =========================== */
.welcome-card,
.error-card,
.step-viewer {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.welcome-card h2 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--accent-blue);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* ===========================
   Buttons
   =========================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    outline: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: #3a8eef;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(74, 158, 255, 0.3);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-active);
}

.btn-large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn-nav {
    background: var(--bg-hover);
    color: var(--text-primary);
    padding: 10px 16px;
}

.btn-nav:hover:not(:disabled) {
    background: var(--accent-blue);
    color: white;
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #45a049;
}

.btn-tts {
    background: var(--bg-hover);
    color: var(--accent-blue);
    margin-top: 15px;
}

.btn-tts:hover {
    background: var(--accent-blue);
    color: white;
}

.btn-tts.speaking {
    background: var(--accent-orange);
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ===========================
   Forms
   =========================== */
.qr-form {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.input-text {
    flex: 1;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s;
}

.input-text:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

/* ===========================
   Scanner Modal
   =========================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 30px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.close-btn:hover {
    background: var(--bg-hover);
}

.modal-body {
    padding: 20px;
}

#reader {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

#scan-result {
    text-align: center;
    padding: 40px;
}

/* ===========================
   Step Viewer
   =========================== */
.progress-section {
    margin-bottom: 25px;
}

.step-indicator {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.step-indicator .current {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent-blue);
}

.step-indicator .total {
    color: var(--text-secondary);
}

.progress-bar {
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-green) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.step-image {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 25px;
    background: var(--bg-secondary);
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-image img {
    width: 100%;
    height: auto;
    display: block;
}

.step-image.placeholder {
    border: 2px dashed var(--border-color);
}

.component-info {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.component-info h3 {
    font-size: 20px;
    margin-bottom: 10px;
}

.component-details {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--bg-hover);
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-primary);
}

.badge.optional {
    background: var(--accent-orange);
    color: white;
}

.instructions-section {
    margin-bottom: 30px;
}

.instructions-section h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--accent-blue);
}

.instructions-text {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    line-height: 1.8;
    color: var(--text-primary);
}

.navigation-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.step-counter {
    padding: 0 20px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* All Steps List */
.all-steps {
    margin-top: 30px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.all-steps summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--accent-blue);
    padding: 10px;
    user-select: none;
}

.all-steps summary:hover {
    color: var(--text-primary);
}

.steps-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s;
}

.step-item:hover {
    background: var(--bg-hover);
    transform: translateX(5px);
}

.step-item.active {
    background: var(--accent-blue);
    color: white;
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-weight: 600;
}

.step-item.active .step-number {
    background: white;
    color: var(--accent-blue);
}

.step-name {
    flex: 1;
}

.step-qty {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===========================
   Error Card
   =========================== */
.error-card {
    text-align: center;
    padding: 60px 30px;
}

.error-icon {
    color: var(--accent-red);
    margin-bottom: 20px;
}

.error-card h2 {
    color: var(--accent-red);
    margin-bottom: 15px;
}

.error-card p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* ===========================
   Product Selection
   =========================== */
.product-selection h2 {
    margin-bottom: 25px;
}

.product-list {
    display: grid;
    gap: 20px;
}

.product-option {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius);
    transition: all 0.3s;
}

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

.product-option h3 {
    margin-bottom: 10px;
    color: var(--accent-blue);
}

.product-option p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.steps-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.step-badge {
    padding: 4px 10px;
    background: var(--bg-card);
    border-radius: 15px;
    font-size: 12px;
    color: var(--text-primary);
}

/* ===========================
   Footer
   =========================== */
.footer {
    background: var(--bg-secondary);
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer.compact {
    padding: 15px;
    font-size: 14px;
}

/* ===========================
   Loader
   =========================== */
.loader {
    width: 50px;
    height: 50px;
    border: 5px solid var(--bg-secondary);
    border-top: 5px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===========================
   Demo Section
   =========================== */
.demo-section {
    margin-top: 40px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px dashed var(--accent-orange);
}

.demo-section h3 {
    color: var(--accent-orange);
    margin-bottom: 15px;
}

.demo-qr-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.demo-qr {
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.demo-qr:hover {
    background: var(--accent-orange);
    color: white;
}

/* ===========================
   Utilities
   =========================== */
.icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.scan-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.manual-input {
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 20px;
    }
    
    .welcome-card,
    .error-card,
    .step-viewer {
        padding: 20px;
    }
    
    .navigation-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .navigation-controls .btn {
        width: 100%;
    }
    
    .step-counter {
        order: -1;
        padding: 10px 0;
    }
    
    .qr-form {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .header {
        padding: 15px 10px;
    }
    
    .welcome-card h2 {
        font-size: 24px;
    }
    
    .btn-large {
        padding: 14px 24px;
        font-size: 16px;
    }
}