/**
 * Professional Scenario Builder Platform Styles
 * Responsive design for mobile, tablet, and desktop
 */

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #7c3aed;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    
    /* Neutral Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #cbd5e1;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-card: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    
    /* Borders & Shadows */
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

body {
    font-family: var(--font-family);
    background: var(--gradient-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   PLATFORM CONTAINER & LAYOUT
   ============================================ */
.platform-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: var(--spacing-md);
    height: 100vh;
    padding: var(--spacing-md);
}

.main-content-wrapper {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

/* ============================================
   HEADER STYLES
   ============================================ */
.platform-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: var(--gradient-primary);
    color: white;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.header-left {
    flex: 1;
}

.platform-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.header-subtitle {
    font-size: var(--font-size-sm);
    opacity: 0.9;
    display: block;
}

.header-right {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* ============================================
   BUTTON STYLES
   ============================================ */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    white-space: nowrap;
}

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

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

.btn-compact {
    padding: 0.5rem 1rem;
    font-size: var(--font-size-xs);
}

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

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

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

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid white;
}

.btn-outline:hover {
    background: white;
    color: var(--primary-color);
}

.btn-mode-toggle {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-full-width {
    width: 100%;
    justify-content: center;
}

.mode-icon {
    font-size: var(--font-size-lg);
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xl);
    background: var(--bg-secondary);
}

/* Custom scrollbar */
.content-area::-webkit-scrollbar,
.notes-container::-webkit-scrollbar {
    width: 8px;
}

.content-area::-webkit-scrollbar-track,
.notes-container::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.content-area::-webkit-scrollbar-thumb,
.notes-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--border-radius-sm);
}

.content-area::-webkit-scrollbar-thumb:hover,
.notes-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   KNOWLEDGE SIDEBAR
   ============================================ */
.knowledge-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.sidebar-header {
    padding: var(--spacing-lg);
    background: var(--gradient-primary);
    color: white;
}

.sidebar-header h2 {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.sidebar-subtitle {
    font-size: var(--font-size-sm);
    opacity: 0.9;
}

.compliance-notice {
    background: #fef3c7;
    color: #92400e;
    padding: var(--spacing-md);
    margin: var(--spacing-md);
    border-radius: var(--border-radius-md);
    border-left: 4px solid var(--warning-color);
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.compliance-notice strong {
    display: block;
    margin-bottom: var(--spacing-xs);
}

.sidebar-actions {
    padding: 0 var(--spacing-md) var(--spacing-md);
}

.notes-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-md);
}

/* ============================================
   NOTE CARDS
   ============================================ */
.note-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    border-left: 4px solid var(--primary-color);
    transition: all 0.2s ease;
}

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

.note-card.note-tip {
    border-left-color: var(--success-color);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: var(--spacing-sm);
}

.note-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: var(--spacing-xs);
}

.note-type-badge.badge-note {
    background: #dbeafe;
    color: #1e40af;
}

.note-type-badge.badge-tip {
    background: #dcfce7;
    color: #166534;
}

.note-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.note-content {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.6;
}

.note-actions {
    display: flex;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-sm);
}

/* ============================================
   SCENARIO GRID
   ============================================ */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.scenario-card {
    background: var(--gradient-card);
    color: white;
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.scenario-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30%, -30%);
}

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

.scenario-card-header {
    margin-bottom: var(--spacing-md);
}

.scenario-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.scenario-description {
    font-size: var(--font-size-sm);
    opacity: 0.9;
    line-height: 1.5;
}

.scenario-meta {
    display: flex;
    gap: var(--spacing-md);
    font-size: var(--font-size-xs);
    opacity: 0.8;
    margin-bottom: var(--spacing-md);
}

.scenario-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* ============================================
   STEP VIEWER
   ============================================ */
.step-viewer {
    max-width: 900px;
    margin: 0 auto;
}

.breadcrumb {
    background: var(--bg-primary);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.step-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--spacing-lg);
}

.step-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: var(--spacing-md);
}

.step-content {
    background: var(--bg-secondary);
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-md);
    line-height: 1.8;
    font-size: var(--font-size-base);
}

.step-script {
    background: #1e293b;
    color: #94a3b8;
    padding: var(--spacing-lg);
    border-radius: var(--border-radius-md);
    font-family: 'Courier New', monospace;
    font-size: var(--font-size-sm);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
    overflow-x: auto;
    white-space: pre-wrap;
}

.step-image-container {
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.step-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: var(--shadow-md);
}

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

.step-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

/* ============================================
   BRANCH NAVIGATION
   ============================================ */
.branch-navigation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.branch-btn {
    padding: var(--spacing-lg);
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

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

.branch-list {
    margin-top: var(--spacing-md);
}

.branch-item {
    background: var(--bg-secondary);
    padding: var(--spacing-md);
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ============================================
   END OF SCENARIO
   ============================================ */
.end-scenario {
    text-align: center;
    padding: var(--spacing-xl) * 2;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
}

.end-scenario h2 {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--spacing-md);
}

.end-scenario p {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-xl);
    opacity: 0.9;
}

.end-scenario-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius-xl);
    padding: var(--spacing-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

/* ============================================
   IMAGE ZOOM MODAL
   ============================================ */
.image-zoom-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.image-zoom-modal.active {
    display: flex;
}

.zoom-container {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    overflow: auto;
    cursor: grab;
}

.zoom-container:active {
    cursor: grabbing;
}

.zoom-image {
    display: block;
    transition: transform 0.2s ease;
    user-select: none;
}

.zoom-controls {
    position: fixed;
    top: var(--spacing-lg);
    right: var(--spacing-lg);
    display: flex;
    gap: var(--spacing-sm);
    z-index: 2001;
}

.zoom-control-btn {
    background: white;
    color: var(--text-primary);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: var(--font-size-xl);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s ease;
}

.zoom-control-btn:hover {
    background: var(--bg-secondary);
    transform: scale(1.1);
}

/* ============================================
   EDIT MODE VISIBILITY
   ============================================ */
.edit-mode-only {
    display: block;
}

.view-mode .edit-mode-only {
    display: none !important;
}

/* ============================================
   LOADING & EMPTY STATES
   ============================================ */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.empty-state {
    text-align: center;
    padding: var(--spacing-xl) * 2;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-lg);
}

.empty-state-text {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-md);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1200px) {
    .platform-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
    
    .knowledge-sidebar {
        max-height: 400px;
    }
}

@media (max-width: 768px) {
    .platform-container {
        padding: var(--spacing-sm);
        gap: var(--spacing-sm);
    }
    
    .platform-header {
        padding: var(--spacing-md);
    }
    
    .platform-title {
        font-size: var(--font-size-xl);
    }
    
    .header-subtitle {
        display: none;
    }
    
    .content-area {
        padding: var(--spacing-md);
    }
    
    .scenarios-grid {
        grid-template-columns: 1fr;
    }
    
    .branch-navigation {
        grid-template-columns: 1fr;
    }
    
    .step-card {
        padding: var(--spacing-md);
    }
}

@media (max-width: 480px) {
    :root {
        --font-size-2xl: 1.25rem;
        --font-size-xl: 1.125rem;
    }
    
    .btn {
        padding: 0.5rem 0.875rem;
        font-size: var(--font-size-xs);
    }
    
    .modal-content {
        padding: var(--spacing-md);
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
    display: none !important;
}

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

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
