/**
 * Interactive Story Book - Stylesheet
 */

/* === Container === */
.isb-wrapper {
    max-width: 900px;
    margin: 20px auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    position: relative;
}

/* === Loading Overlay === */
.isb-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
}

.isb-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: isb-spin 1s linear infinite;
}

@keyframes isb-spin {
    to { transform: rotate(360deg); }
}

.isb-loading p {
    margin-top: 20px;
    font-size: 18px;
    font-weight: 500;
}

/* === Mode Toggle === */
.isb-mode-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 4px;
    border-radius: 12px;
}

.isb-toggle-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 16px;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.isb-toggle-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.isb-toggle-btn:not(.disabled):not(.active):hover {
    background: rgba(255, 255, 255, 0.3);
}

.isb-toggle-btn .isb-icon {
    font-size: 24px;
}

/* === Screen Container === */
.isb-screen {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* === Welcome Section === */
.isb-welcome {
    text-align: center;
    margin-bottom: 40px;
}

.isb-welcome h1 {
    font-size: 32px;
    margin: 0 0 10px 0;
    color: #1a202c;
}

.isb-welcome p {
    font-size: 18px;
    color: #718096;
    margin: 0;
}

/* Kapitel-Navigation */
.isb-chapter-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f7fafc;
    border-radius: 10px;
    margin-bottom: 20px;
}

.isb-nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.isb-nav-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

.isb-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #cbd5e0;
    color: #a0aec0;
}

.isb-chapter-indicator {
    font-size: 12px;
    font-weight: bold;
    color: #2d3748;
}

.isb-chapter-indicator .isb-divider {
    margin: 0 8px;
    color: #cbd5e0;
}

/* === Form Elements === */
.isb-form {
    max-width: 500px;
    margin: 0 auto;
}

.isb-form-group {
    margin-bottom: 25px;
}

.isb-form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
}

.isb-input,
.isb-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
}

.isb-input:focus,
.isb-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.isb-hint {
    font-size: 14px;
    color: #718096;
    margin: 8px 0 0 0;
}

/* === Buttons === */
.isb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.isb-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.isb-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.isb-btn-primary:active {
    transform: translateY(0);
}

.isb-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.isb-btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.isb-btn-secondary:hover {
    background: #667eea;
    color: white;
}

.isb-btn-text {
    background: transparent;
    color: #667eea;
    padding: 8px 12px;
}

.isb-btn-text:hover {
    background: rgba(102, 126, 234, 0.1);
}

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

.isb-btn-block {
    width: 100%;
}

/* === Story Screen === */
.isb-story-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.isb-story-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #718096;
}

.isb-story-meta span:first-child {
    font-weight: 600;
    color: #2d3748;
    font-size: 16px;
}

.isb-divider {
    color: #cbd5e0;
}

/* === Back Header === */
.isb-back-header {
    margin-bottom: 20px;
}

/* === Story Display === */
.isb-story-display {
    background: #f7fafc;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    min-height: 300px;
    line-height: 1.8;
    font-size: 16px;
    color: #2d3748;
    white-space: pre-wrap;
    max-height: 70vh;
    overflow-y: auto;
}

.isb-chapter {
    margin-bottom: 30px;
}

.isb-chapter:last-child {
    margin-bottom: 0;
}

.isb-chapter-separator {
    text-align: center;
    color: #a0aec0;
    font-weight: 600;
    margin: 30px 0;
    padding: 15px 0;
    border-top: 2px dashed #e2e8f0;
    border-bottom: 2px dashed #e2e8f0;
}

/* === Warnings === */
.isb-warning {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #fef5e7;
    border-left: 4px solid #f39c12;
    border-radius: 8px;
    margin-bottom: 20px;
}

.isb-warning .isb-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.isb-warning-content strong {
    display: block;
    color: #d68910;
    margin-bottom: 4px;
}

.isb-warning-content p {
    margin: 0;
    color: #7d6608;
    font-size: 14px;
}

/* === Input Section === */
.isb-input-section {
    background: #f7fafc;
    border-radius: 12px;
    padding: 25px;
}

.isb-action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* === Icons === */
.isb-icon {
    display: inline-block;
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
    .isb-wrapper {
        padding: 10px;
        margin: 10px;
    }
    
    .isb-screen {
        padding: 20px;
    }
    
    .isb-welcome h1 {
        font-size: 24px;
    }
    
    .isb-welcome p {
        font-size: 16px;
    }
    
    .isb-toggle-btn {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .isb-toggle-btn .isb-icon {
        font-size: 20px;
    }
    
    .isb-toggle-btn .isb-label {
        display: none;
    }
    
    .isb-story-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .isb-story-meta {
        flex-wrap: wrap;
        font-size: 12px;
    }
    
    .isb-story-display {
        padding: 20px;
        font-size: 15px;
    }
    
    .isb-action-buttons {
        flex-direction: column;
    }
    
    .isb-btn {
        width: 100%;
        justify-content: center;
    }
}

/* === Touch-Optimierung für App === */
@media (max-width: 640px) {
    .isb-input,
    .isb-select,
    .isb-btn {
        font-size: 16px; /* Verhindert Auto-Zoom auf iOS */
    }
    
    .isb-story-display {
        -webkit-overflow-scrolling: touch; /* Smooth scrolling auf iOS */
    }
}

/* === Print-Styles === */
@media print {
    .isb-mode-toggle,
    .isb-story-header,
    .isb-back-header,
    .isb-input-section,
    .isb-warning {
        display: none;
    }
    
    .isb-story-display {
        background: white;
        max-height: none;
        overflow: visible;
    }
}