* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.page-card .card-body {
    margin-top: 14px;
}

.page-card.collapsed .card-body {
    display: none;
}

/* Page Preview Styles */
.page-preview {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    align-items: flex-start;
    flex-wrap: wrap;
    overflow-x: visible;
    margin-left: 12px;
}

.preview-item { 
    display: flex; 
    align-items: center; 
    gap: 4px; 
    padding: 3px 6px; 
    background: transparent; 
    border: none;
    border-radius: 0; 
    white-space: nowrap;
    flex-shrink: 0;
}

.preview-label {
    font-weight: 600;
    color: #58a6ff;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.preview-thumbnail { 
    width: 24px; 
    height: 24px; 
    background-size: cover; 
    background-position: center; 
    border-radius: 3px; 
    border: 2px solid #00d4ff; 
    box-shadow: 0 0 4px rgba(0, 212, 255, 0.3);
}

.text-preview {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: center;
}

.preview-text { 
    font-size: 11px; 
    white-space: normal; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    max-width: 100%; 
    color: #8b949e;
    line-height: 1.3;
}

.no-preview {
    font-style: italic;
    color: #6e7681;
    font-size: 11px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #010409;
    color: #e6edf3;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background: #1a1f2e;
    padding: 12px;
    overflow-y: auto;
    border-right: 2px solid #0d1117;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

.sidebar h1 {
    color: #e0ecff;
    margin-bottom: 16px;
    font-size: 20px;
    font-weight: 700;
    padding: 8px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2a4a6f 100%);
    border-radius: 6px;
    border: 1px solid #2d5a8a;
}

.section {
    margin-bottom: 16px;
}

.section h3 {
    color: #00d4ff;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input[type="text"], textarea {
    width: 100%;
    padding: 8px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 5px;
    color: #e8eef4;
    font-size: 13px;
    margin-bottom: 8px;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus, textarea:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

textarea {
    resize: vertical;
    min-height: 60px;
}

button {
    width: 100%;
    padding: 9px;
    background: linear-gradient(135deg, #2e6f9e 0%, #1e5a8a 100%);
    border: 1px solid #3d7eb0;
    border-radius: 5px;
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:hover {
    background: linear-gradient(135deg, #3580b0 0%, #25659a 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 212, 255, 0.2);
}

button.secondary {
    background: linear-gradient(135deg, #263241 0%, #1a2633 100%);
    color: #e0e8f0;
    border: 1px solid #3b495a;
}

button.secondary:hover {
    background: linear-gradient(135deg, #2f3d4f 0%, #21303f 100%);
    border-color: #4a5866;
}

.load-drop-zone {
    position: relative;
    line-height: 1.3;
    padding: 10px 9px !important;
}

.load-drop-zone.drag-over {
    background: linear-gradient(135deg, #1e4a5f 0%, #2a5a6f 100%) !important;
    border-color: #00d4ff !important;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.2) !important;
}

.main-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #0d1117;
}

.main-content h2 {
    color: #e0ecff;
    margin-bottom: 14px;
    font-size: 18px;
    font-weight: 600;
}

.page-card {
    background: #1a1f2e;
    border: 2px solid #21262d;
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 20px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    transition: border-color 0.2s ease;
}

.page-card:hover {
    border-color: #30363d;
}

.page-card h4 {
    color: #e9f3ff;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2a4a6f 100%);
    border: 1px solid #2d5a8a;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
}

.drop-zone {
    border: 2px dashed #30363d;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #0d1117;
    position: relative;
    min-height: 100px;
    height: 100px; /* Fixed height to prevent expansion */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    overflow: hidden; /* Prevent overflow */
}

.drop-zone:hover { 
    background: #161b22; 
    border-color: #4a90cc;
    box-shadow: 0 0 0 3px rgba(74, 144, 204, 0.1);
}

.drop-zone.active { 
    background: #162936; 
    border-color: #00d4ff;
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15);
}

.drop-zone.has-file { 
    border-color: #00d4ff; 
    border-style: solid;
    background: #0f1c26; 
}

.drop-zone img { max-width: 100%; max-height: 90px; margin-top: 8px; border-radius: 5px; }

.file-info { color: #9bdcff; font-size: 11px; margin-top: 4px; }

.remove-file {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff4444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    z-index: 10;
    width: auto;
}

.remove-file:hover {
    background: #cc0000;
    transform: none;
}

.delete-page {
    background: #ff4444;
    color: white;
    padding: 5px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    width: auto;
}

.delete-page:hover {
    background: #cc0000;
}

.textarea-wrapper {
    position: relative;
    width: 100%;
    background: #161b22;
    border-radius: 5px;
}

.textarea-highlight {
    position: absolute;
    top: 0;
    left: 0;
    width: calc(100% - 2px);
    height: 100%;
    padding: 8px;
    margin: 1px;
    border-radius: 5px;
    font-size: 15px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow: hidden;
    pointer-events: none;
    color: #e8eef4;
    z-index: 1;
}

.tag-highlight {
    color: #7dd3fc;
    font-weight: 500;
}

.text-input { 
    position: relative;
    z-index: 2;
    min-height: 120px; 
    overflow-y: auto;
    background: transparent !important;
    border: 1px solid #30363d !important;
    line-height: 1.6;
    font-size: 15px !important;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    color: transparent;
    caret-color: #e8eef4;
    resize: none;
    -webkit-text-fill-color: transparent;
}

.text-input:focus {
    background: transparent !important;
    outline: none;
}

.text-input.over-limit {
    border-color: #ff5252 !important;
    animation: blink-red 1s infinite;
}

@keyframes blink-red {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.0);
        background-color: #0f3460;
    }
    50% {
        box-shadow: 0 0 0 3px rgba(255, 82, 82, 0.6);
        background-color: #2a1a1a;
    }
}

/* New media row grid for the three drop zones */
.media-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }

.media-cell strong {
    display: block;
    margin-bottom: 6px;
    color: #00d4ff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vfx-section {
    margin-bottom: 10px;
    padding: 10px;
    background: #0d1117;
    border: 2px solid #21262d;
    border-radius: 6px;
}

.vfx-section strong {
    display: block;
    margin-bottom: 6px;
    color: #00d4ff;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vfx-section select {
    width: 100%;
    padding: 8px 10px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 5px;
    color: #e8eef4;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.vfx-section select:hover {
    border-color: #4a90cc;
}

.vfx-section select:focus {
    outline: none;
    border-color: #00d4ff;
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.1);
}

.text-section { 
    background: #0d1117; 
    border: 2px solid #21262d; 
    border-radius: 6px; 
    padding: 10px; 
}

.format-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.format-group {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 5px;
    padding: 8px;
    flex: 0 0 auto;
}

.format-group-label {
    font-size: 11px;
    font-weight: 700;
    color: #00d4ff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.format-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.format-colors {
    gap: 4px;
}

.fmt-btn {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
    background: linear-gradient(135deg, #1a2633 0%, #0d1117 100%);
    border: 1px solid #30363d;
    color: #00d4ff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.fmt-btn:hover { 
    background: linear-gradient(135deg, #2a3844 0%, #1a2633 100%); 
    border-color: #4a90cc;
    box-shadow: 0 0 0 2px rgba(74, 144, 204, 0.1);
}

.fmt-wiggle {
    animation: subtle-wiggle 2s infinite;
}

.fmt-pulse {
    animation: subtle-pulse 1.5s infinite;
}

.fmt-bloom {
    font-weight: 600;
    filter: brightness(1) drop-shadow(0 0 2px #00d4ff);
}

@keyframes subtle-wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(2deg); }
    75% { transform: rotate(-2deg); }
}

@keyframes subtle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.color-btn {
    width: 32px !important;
    height: 32px;
    padding: 0 !important;
    font-size: 16px;
    border: 2px solid rgba(0, 0, 0, 0.3) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4) !important;
}

.fmt-remove {
    background: linear-gradient(135deg, #5a1a1a 0%, #3a0d0d 100%) !important;
    border: 1px solid #7a2323 !important;
    color: #ff6b6b !important;
    width: 32px !important;
    height: 32px;
    padding: 0 !important;
    font-size: 18px;
    font-weight: 700;
}

.fmt-remove:hover {
    background: linear-gradient(135deg, #7a2323 0%, #5a1a1a 100%) !important;
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2) !important;
    transform: scale(1.05);
}

.text-section > summary {
    list-style: none;
    cursor: pointer;
    color: #00d4ff;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}

.text-section[open] > summary { margin-bottom: 10px; }

.text-section > summary::-webkit-details-marker {
    display: none;
}

@media (max-width: 1200px) {
    .media-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 800px) {
    .media-row {
        grid-template-columns: 1fr;
    }
}

.add-page-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: #000;
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.5);
    border: 2px solid #00e5ff;
    transition: all 0.2s ease;
    z-index: 9999; /* Highest layer */
    cursor: pointer;
}

.add-page-btn:hover {
    box-shadow: 0 6px 24px rgba(0, 212, 255, 0.7);
    transform: scale(1.05);
    background: linear-gradient(135deg, #00e5ff 0%, #00aadd 100%);
}

.help-text {
    font-size: 11px;
    color: #8b949e;
    line-height: 1.5;
    background: #0d1117;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #21262d;
}

.help-text p {
    margin: 6px 0;
}

.help-text strong {
    color: #00d4ff;
    font-weight: 600;
}

input[type="file"] {
    display: none;
}

.page-number { 
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%); 
    color: #000; 
    padding: 4px 10px; 
    border-radius: 5px; 
    font-size: 12px; 
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 212, 255, 0.3);
}

.card-actions {
    display: inline-flex;
    gap: 6px;
    margin-left: 10px;
}

.icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 1px solid #30363d;
    background: linear-gradient(135deg, #1a2633 0%, #0d1117 100%);
    color: #00d4ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.icon-btn:hover { 
    background: linear-gradient(135deg, #2a3844 0%, #1a2633 100%); 
    border-color: #4a90cc;
    box-shadow: 0 0 0 2px rgba(74, 144, 204, 0.1);
}
.icon-btn:disabled { opacity: .4; cursor: default; }
.icon-btn.danger { 
    background: linear-gradient(135deg, #5a1a1a 0%, #3a0d0d 100%); 
    border-color: #7a2323; 
    color: #ff6b6b; 
}
.icon-btn.danger:hover { 
    background: linear-gradient(135deg, #7a2323 0%, #5a1a1a 100%); 
    box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.15);
}

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #0d1117;
    border-left: 1px solid #21262d;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    border-radius: 6px;
    border: 2px solid #0d1117;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #00e5ff 0%, #00aadd 100%);
}

.success-message {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #00ff88 0%, #00cc66 100%);
    color: #000;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    animation: slideIn 0.3s ease-out;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 255, 136, 0.4);
    border: 1px solid #00ff88;
}

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