/**
 * ViziFDX - Consolidated Stylesheet
 * Screenplay Visualization and Analysis Application
 */

/* ============================================
   ROOT VARIABLES & BASE STYLES
   ============================================ */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --dark-color: #2c3e50;
    --light-color: #f8f9fa;
    --border-color: #dee2e6;
    --text-muted: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
}

body {
    background: var(--light-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden;
}

/* ============================================
   NAVBAR STYLES
   ============================================ */

.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    color: white !important;
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-text {
    color: rgba(255,255,255,0.9) !important;
}

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

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
    color: white;
}

/* ============================================
   HEADER STYLES
   ============================================ */

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0.75rem 0;
    margin-bottom: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.header h1 {
    margin-bottom: 0.5rem;
}

.header p {
    opacity: 0.95;
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.btn-header {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.9rem;
}

.btn-header:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    border-color: rgba(255,255,255,0.5);
}

/* ============================================
   CARD STYLES
   ============================================ */

.section-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.dashboard-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}

.card-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.script-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
}

.script-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.script-card h5 {
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* ============================================
   METRIC & ANALYTICS STYLES
   ============================================ */

.metric-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.metric-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0;
}

.metric-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.5rem;
}

.metric-icon {
    font-size: 2rem;
    color: var(--primary-color);
    opacity: 0.3;
    float: right;
}

.script-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   SCREENPLAY WRITER STYLES
   ============================================ */

/* Ensure Courier font only for screenplay content */
.script-container,
.line-input,
.script-line {
    font-family: 'Courier New', Courier, monospace;
}

/* Scene viewer container - centered on page */
.scene-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.main-container {
    display: flex;
    height: calc(100vh - 120px);
}

.left-panel {
    width: 40%;
    min-width: 400px;
    display: flex;
    flex-direction: column;
    background: white;
    border-right: 2px solid var(--border-color);
}

.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--light-color);
    overflow: hidden;
}

.right-panel-header {
    background: white;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.right-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

/* Type Selector */
.type-selector {
    background: white;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.type-btn {
    flex: 1;
    padding: 0.75rem 0.5rem;
    margin: 0.25rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: center;
}

.type-btn:hover {
    background: var(--light-color);
    border-color: var(--primary-color);
}

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

.type-btn kbd {
    background: rgba(0,0,0,0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.75rem;
    display: block;
    margin-top: 0.25rem;
}

.type-buttons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

/* Writing Area */
.writing-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow-y: auto;
}

/* Script Container */
.script-container {
    max-width: 8.5in;
    margin: 0 auto;
    background: white;
    padding: 1in;
    min-height: calc(100vh - 120px);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.script-lines {
    position: relative;
    padding-left: 50px;
}

.script-line {
    margin-bottom: 0;
    padding: 0.25rem 0.5rem;
    line-height: 1.2;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.script-line:hover {
    background: #e3f2fd;
    border-radius: 4px;
    padding-left: 1rem;
}

.script-line.editing {
    background: #fff3cd;
    border-left: 3px solid var(--warning-color);
    padding-left: 1rem;
}

/* Line Numbers */
.line-number {
    position: absolute;
    left: -40px;
    color: #999;
    font-size: 0.75rem;
    width: 30px;
    text-align: left !important;
    direction: ltr;
}

.line-transition .line-number,
.line-character .line-number,
.line-parenthetical .line-number {
    text-align: left !important;
}

.line-character .line-number {
    left: calc(-2in - 40px);
}

.line-parenthetical .line-number {
    left: calc(-1.5in - 40px);
}

.line-dialogue .line-number {
    left: calc(-1in - 40px);
}

/* Line Type Formatting */
.line-scene_heading {
    text-transform: uppercase;
    font-weight: bold;
    margin-top: 1.5rem;
}

.line-action {
    margin: 0.5rem 0;
}

.line-character {
    text-transform: uppercase;
    margin-left: 2in;
    margin-top: 1rem;
}

.line-parenthetical {
    margin-left: 1.5in;
    margin-right: 2in;
}

.line-dialogue {
    margin-left: 1in;
    margin-right: 1.5in;
}

.line-transition {
    text-transform: uppercase;
    text-align: right;
    margin-top: 1rem;
}

/* Input Area */
.input-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.line-input {
    width: 100%;
    border: 1px solid var(--border-color);
    outline: none;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12pt;
    padding: 1rem;
    background: white;
    border-radius: 4px;
    resize: vertical;
    height: 100px;
    max-height: 300px;
}

.line-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.context-info {
    font-size: 0.85rem;
}

.context-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: #e9ecef;
    border-radius: 3px;
    margin: 0 0.25rem;
}

/* ============================================
   BUTTON STYLES
   ============================================ */

.btn-add {
    padding: 0.5rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btn-add:hover {
    background: #5568d3;
}

.btn-add:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-upload {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.btn-upload:hover {
    background: #5568d3;
    color: white;
}

.btn-back {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

.btn-back:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    border-color: rgba(255,255,255,0.5);
}

.btn-generate {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-generate:hover {
    background: #5568d3;
}

.btn-nav {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s ease;
}

.btn-nav:hover {
    background: #5568d3;
    color: white;
}

.btn-nav:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.btn-pdf {
    padding: 0.75rem 1.5rem;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    font-weight: 600;
}

.btn-pdf:hover {
    background: #c82333;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btn-primary-large {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-primary-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
    color: white;
}

.utility-buttons {
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
}

.utility-btn {
    flex: 1;
    padding: 0.5rem;
    background: white;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.utility-btn:hover {
    background: var(--light-color);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* ============================================
   HELPER & NOTIFICATION STYLES
   ============================================ */

.helper-text {
    background: #fff3cd;
    padding: 0.75rem;
    border-left: 3px solid var(--warning-color);
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.empty-state i {
    font-size: 4rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

/* ============================================
   MODE INDICATORS
   ============================================ */

.mode-indicator {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    display: none;
    align-items: center;
    justify-content: space-between;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
}

.mode-indicator.show {
    display: flex;
}

.mode-indicator.edit-mode {
    background: var(--warning-color);
    color: #000;
}

.mode-indicator.insert-mode {
    background: var(--success-color);
    color: white;
}

.cancel-mode-btn {
    padding: 0.25rem 0.75rem;
    background: rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.cancel-mode-btn:hover {
    background: rgba(255,255,255,0.5);
}

/* ============================================
   INSERT LINE CONTROLS
   ============================================ */

.insert-line-trigger {
    position: relative;
    height: 4px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.insert-line-trigger::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: transparent;
    transition: background 0.2s ease;
}

.insert-line-trigger:hover::before {
    background: var(--primary-color);
}

.insert-line-btn {
    position: relative;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.75rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 10;
}

.insert-line-trigger:hover .insert-line-btn {
    opacity: 1;
}

.insert-line-btn:hover {
    background: #5568d3;
    transform: scale(1.05);
}

/* ============================================
   KEYBOARD SHORTCUTS PANEL
   ============================================ */

.shortcuts-panel {
    background: var(--light-color);
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 0.85rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.shortcuts-panel.show {
    max-height: 300px;
}

.shortcuts-panel h6 {
    margin-bottom: 0.75rem;
    color: #495057;
}

.shortcuts-panel div {
    padding: 0.25rem 0;
    display: flex;
    justify-content: space-between;
}

.shortcuts-toggle {
    width: 100%;
    padding: 0.5rem;
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.2s ease;
}

.shortcuts-toggle:hover {
    background: var(--light-color);
}

.shortcuts-container {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   BADGE & PILL STYLES
   ============================================ */

.format-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.badge-login {
    background: var(--primary-color);
}

.badge-password {
    background: var(--warning-color);
}

.badge-register {
    background: var(--success-color);
}

.badge-new {
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

.badge-custom {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
}

.stat-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--light-color);
    border-radius: 6px;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.stat-badge strong {
    color: var(--primary-color);
}

/* ============================================
   LIST & TABLE STYLES
   ============================================ */

.event-item {
    padding: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.event-item:last-child {
    border-bottom: none;
}

.list-item {
    padding: 1rem;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background 0.2s ease;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background: var(--light-color);
}

.list-item-title {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-date {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--primary-color);
}

.progress-bar-custom {
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.character-rank {
    display: inline-block;
    width: 30px;
    height: 30px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 30px;
    font-weight: bold;
    margin-right: 0.5rem;
}

/* ============================================
   IMAGE GALLERY & LIGHTBOX
   ============================================ */

.gallery-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.filter-pills {
    margin-bottom: 2rem;
    overflow-x: auto;
    white-space: nowrap;
    padding: 0.5rem 0;
}

.filter-pill {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    background: white;
    border-radius: 50px;
    text-decoration: none;
    color: #495057;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.filter-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    color: var(--primary-color);
}

.filter-pill.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.filter-pill .badge {
    margin-left: 0.5rem;
    background: rgba(0,0,0,0.1);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.gallery-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

.gallery-item-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: #e9ecef;
}

.gallery-item-content {
    padding: 1rem;
}

.gallery-item-type {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.gallery-item-name {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-item-prompt {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-item-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e9ecef;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 9999;
    overflow: auto;
}

.lightbox-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    margin: auto;
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.lightbox-info {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    max-width: 800px;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    z-index: 10000;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    transform: scale(1.2);
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 50px;
    cursor: pointer;
    background: rgba(0,0,0,0.5);
    padding: 1rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-nav:hover {
    background: rgba(255,255,255,0.2);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-next {
    right: 30px;
}

/* ============================================
   WORD CLOUD & VISUALIZATION STYLES
   ============================================ */

.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    display: block;
}

#wordCloudCanvas {
    width: 100%;
    height: 600px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.stoplist-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.75rem;
    background: var(--light-color);
}

.stopword-tag {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.stopword-tag .remove-btn {
    margin-left: 0.5rem;
    cursor: pointer;
    opacity: 0.8;
}

.stopword-tag .remove-btn:hover {
    opacity: 1;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-container input[type="range"] {
    flex: 1;
}

.slider-value {
    min-width: 60px;
    text-align: center;
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.stats-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--light-color);
    border-radius: 4px;
}

.stat-item {
    flex: 1;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ============================================
   SCENE NAVIGATION
   ============================================ */

.scene-info {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.navigation-buttons {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.navigation-buttons > div:first-child {
    justify-self: start;
}

.navigation-buttons > div:last-child {
    justify-self: end;
}

/* ============================================
   DASHBOARD & CTA SECTIONS
   ============================================ */

.dashboard-header {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.cta-section {
    text-align: center;
    padding: 3rem 0;
    margin: 2rem 0;
}

/* ============================================
   ONBOARDING & ANIMATIONS
   ============================================ */

.onboarding-step {
    animation: fadeIn 0.3s ease-in;
}

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

/* ============================================
   AUTH PAGES (Login, Register, etc.)
   ============================================ */

.auth-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.auth-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.auth-header p {
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
}

.auth-body {
    padding: 2rem;
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* ============================================
   LANDING PAGE
   ============================================ */

.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 100px 0 80px 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,138.7C960,139,1056,117,1152,101.3C1248,85,1344,75,1392,69.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.hero-tagline {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    font-weight: 300;
    opacity: 0.95;
}

.hero-buttons .btn {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 10px;
    border-radius: 50px;
    transition: all 0.3s ease;
}

.btn-light-custom {
    background: white;
    color: var(--primary-color);
    border: none;
}

.btn-light-custom:hover {
    background: var(--light-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

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

.btn-outline-light-custom:hover {
    background: white;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.features-section {
    padding: 80px 0;
    background: white;
}

.feature-card {
    text-align: center;
    padding: 30px;
    border-radius: 10px;
    transition: all 0.3s ease;
    height: 100%;
}

.feature-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
}

.section-title h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.section-title p {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.benefits-section {
    padding: 80px 0;
    background: var(--light-color);
}

.benefit-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 30px;
}

.benefit-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    margin-right: 20px;
    flex-shrink: 0;
}

.benefit-content h5 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.benefit-content p {
    color: var(--text-muted);
    line-height: 1.6;
}

.cta-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
}

.cta-section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.cta-section p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    opacity: 0.95;
}

.footer {
    background: #2c3e50;
    color: white;
    padding: 60px 0 20px 0;
}

.footer h5 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: white;
}

.footer p {
    color: rgba(255,255,255,0.8);
    line-height: 1.6;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.footer-bottom p {
    color: rgba(255,255,255,0.6);
    font-size: 0.9rem;
}

/* ============================================
   CANVAS & CHARTS
   ============================================ */

canvas {
    max-height: 300px;
}

/* Network visualization container */
.network-container {
    width: 100%;
    height: 800px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    overflow: hidden;
    position: relative;
}

#characterNetwork {
    width: 100%;
    height: 100%;
}

/* Network zoom controls */
.network-zoom-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-zoom {
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn-zoom:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-zoom:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Legend styles for network diagram */
.legend-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.legend-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #667eea;
    margin-right: 1rem;
}

.legend-size-small {
    width: 20px;
    height: 20px;
}

.legend-size-medium {
    width: 30px;
    height: 30px;
}

.legend-size-large {
    width: 40px;
    height: 40px;
}

.legend-line {
    width: 60px;
    height: 2px;
    background: #cccccc;
    margin-right: 1rem;
}

.legend-line-thick {
    height: 5px;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .header, .left-panel, .right-panel-header, .insert-line-trigger {
        display: none !important;
    }

    .main-container {
        display: block;
    }

    .right-panel {
        width: 100%;
    }

    .script-container {
        box-shadow: none;
        margin: 0;
        padding: 0.5in;
    }

    .line-number {
        display: none !important;
    }

    .script-line {
        cursor: default;
    }

    .script-line:hover {
        background: none;
        padding-left: 0.5rem;
    }
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

@media (max-width: 1024px) {
    .left-panel {
        width: 45%;
        min-width: 350px;
    }

    .type-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.25rem;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }

    .left-panel {
        width: 100%;
        height: 50vh;
        border-right: none;
        border-bottom: 2px solid var(--border-color);
    }

    .right-panel {
        height: 50vh;
    }

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

    .gallery-item-image {
        height: 150px;
    }

    .lightbox-nav {
        font-size: 30px;
        padding: 0.5rem;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }
}

/* ============================================
   LOGIN PAGE SPECIFIC STYLES
   ============================================ */

/* Full-screen gradient background for standalone auth pages */
body.login-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
}

/* Enhanced form controls for login pages */
body.login-page .form-control {
    padding: 0.75rem;
    border-radius: 8px;
    border: 2px solid #e9ecef;
}

body.login-page .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

body.login-page .btn-primary-custom {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    padding: 0.75rem;
    font-weight: 600;
    border-radius: 8px;
    width: 100%;
    color: white;
    transition: transform 0.2s ease;
}

body.login-page .btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

body.login-page .alert {
    border-radius: 8px;
    border: none;
}

.forgot-password-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    cursor: pointer;
}

.forgot-password-link:hover {
    text-decoration: underline;
}

/* Modal styling for login pages */
.modal-content {
    border-radius: 16px;
    overflow: hidden;
}

.modal-header.gradient-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
}

/* Success message styling */
body.login-page .success-message {
    background: white;
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

body.login-page .success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;
    color: white;
}

/* Back to home link styling */
body.login-page .back-link {
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s ease;
}

body.login-page .back-link:hover {
    opacity: 1;
    color: white;
}

/* ============================================
   FOOTER STYLES
   ============================================ */

.site-footer {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 2rem 0;
    margin-top: 4rem;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

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

.footer-content p {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Ensure footer stays at bottom on short pages */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

body > .container,
body > div:not(.site-footer) {
    flex: 1;
}
