/* Minimalist Premium Theme CSS */
:root {
    --bg-main: #FFFFFF;
    --bg-surface: #F9FAFB;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    
    --primary: #111827; /* Dark almost black */
    --primary-hover: #334155;
    
    --radius-full: 9999px;
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    --line-color: #ef4444; /* Keep cut lines noticeable */
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
}

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

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

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

/* Base Buttons */
.btn {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.black-pill {
    background-color: var(--primary);
    color: white;
    padding: 16px 32px;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

.black-pill:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.outline-pill {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-dark);
    padding: 12px 24px;
    border-radius: var(--radius-full);
}

.outline-pill:hover {
    background-color: var(--bg-surface);
    border-color: #cbd5e1;
}

.w-full { width: 100%; }
.mt-4 { margin-top: 16px; }

/* View System */
.view-state {
    display: none;
    height: 100vh;
    width: 100vw;
}

.view-state.active {
    display: flex;
}

/* Landing View */
#landing-view {
    align-items: center;
    justify-content: center;
    text-align: center;
    background: var(--bg-main);
}

.landing-content {
    max-width: 640px;
    padding: 40px;
    animation: fadeIn 0.8s ease;
}

.brand-logo i {
    font-size: 36px;
    color: var(--primary);
    margin-bottom: 24px;
}

.hero-graphic {
    background: var(--bg-surface);
    display: inline-flex;
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
}

.hero-graphic i {
    font-size: 40px;
    color: #94a3b8;
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 16px;
    letter-spacing: -0.04em;
    color: var(--text-dark);
}

.hero-subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 40px;
}

.hero-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 24px;
    line-height: 1.5;
}

/* Editor View */
#editor-view {
    flex-direction: column;
    background-color: var(--bg-surface);
}

.editor-header {
    height: 60px;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 10;
}

.header-brand {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
}

.file-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-full);
}

.icon-btn {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.2s;
}

.icon-btn:hover:not(:disabled) {
    background: white;
    color: var(--text-dark);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.icon-btn:disabled {
    opacity: 0.3;
}

.file-counter-text {
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 45px;
    text-align: center;
    color: var(--text-dark);
    font-variant-numeric: tabular-nums;
}

.editor-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Settings Panel */
.settings-panel {
    width: 360px;
    background: var(--bg-main);
    border-right: 1px solid var(--border);
    padding: 32px 28px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

/* Customize scrollbar inside settings */
.settings-panel::-webkit-scrollbar { width: 6px; }
.settings-panel::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }

.panel-section h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
    margin-bottom: 24px;
}

.control-group {
    margin-bottom: 24px;
}

.control-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: var(--text-dark);
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
}

input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 18px;
    width: 18px;
    border-radius: 50%;
    background: var(--text-dark);
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    cursor: pointer;
    margin-top: -7px;
    transition: transform 0.1s;
}
input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
}

.value-display {
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 55px;
    text-align: right;
    color: var(--text-dark);
}

/* Select Box */
.select-wrapper select {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 0.9rem;
    appearance: none;
    background-color: white;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
    cursor: pointer;
    transition: border-color 0.2s;
}
.select-wrapper select:focus {
    outline: none;
    border-color: var(--text-dark);
}

/* Radio Buttons for toggle */
.radio-group { 
    display: flex; 
    gap: 8px; 
    background: #f1f5f9;
    padding: 4px;
    border-radius: var(--radius-md);
}
.radio-btn { flex: 1; position: relative; cursor: pointer; }
.radio-btn input { position: absolute; opacity: 0; }
.btn-text {
    display: block; text-align: center; padding: 8px 0;
    border-radius: var(--radius-sm);
    font-size: 0.85rem; transition: background 0.2s, color 0.2s;
    color: var(--text-muted);
}
.radio-btn input:checked ~ .btn-text {
    background: white; 
    color: var(--text-dark); 
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.export-actions {
    display: flex; flex-direction: column; gap: 12px; margin-top: 8px;
}

.privacy-note {
    margin-top: auto;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.6;
}

/* Canvas Preview Area */
.canvas-preview-area {
    flex: 1;
    overflow-y: auto;
    position: relative;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    /* subtle pattern */
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
}
.canvas-preview-area::-webkit-scrollbar { width: 8px; }
.canvas-preview-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.file-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    font-weight: 500;
    background: white;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

canvas {
    max-width: 500px;
    width: 100%;
    height: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    border-radius: 8px;
    background: white; /* fallback */
    display: block;
}

#split-lines-container {
    position: absolute;
    top: 99px; /* roughly padding-top + file-title + margins */
    width: 100%;
    max-width: 500px;
    height: calc(100% - 150px);
    pointer-events: none;
}

.scroll-instruction {
    position: fixed;
    bottom: 32px;
    left: calc(50% + 180px); /* offset partially for sidebar */
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.85); /* Dark overlay */
    backdrop-filter: blur(8px);
    color: white;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
    font-weight: 500;
}
.scroll-instruction.show {
    opacity: 1;
}

/* Draggable Tool */
.split-line {
    position: absolute;
    width: 100%;
    height: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: ns-resize;
    pointer-events: auto;
    z-index: 10;
    display: flex;
    align-items: center;
}

.split-line::before {
    content: '';
    position: absolute;
    top: 5px;
    width: 100%;
    height: 2px;
    background-color: var(--line-color);
    box-shadow: 0 0 4px rgba(239, 68, 68, 0.4);
    border-bottom: 2px dashed rgba(255, 255, 255, 0.9);
    transition: all 0.2s;
}

.split-line::after {
    content: '\f0c4'; /* Scissors */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: -28px;
    color: var(--line-color);
    font-size: 13px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    transition: transform 0.2s;
}

.split-line:hover::before, .split-line.dragging::before {
    height: 3px;
    top: 4.5px;
}

.split-line:hover::after, .split-line.dragging::after {
    transform: scale(1.1);
}

.split-line .drag-handle {
    position: absolute;
    right: -36px;
    background: white;
    border: 1px solid var(--border);
    color: var(--text-dark);
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.split-line:hover .drag-handle, .split-line.dragging .drag-handle {
    opacity: 1;
}

/* Overlays */
.loading-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--text-dark);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 24px;
}

.loading-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    animation: pulse 1.5s ease-in-out infinite;
}

/* Global Site Watermark */
.site-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-30deg);
    font-size: 8rem;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.03); /* Very subtle */
    pointer-events: none; /* Crucial: so it doesn't block clicks/drags */
    z-index: 1; /* Below the modals and split lines, but above the background */
    white-space: nowrap;
    user-select: none;
}

.drag-drop-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border: 4px dashed var(--border);
}

.drag-drop-overlay.dragover {
    border-color: var(--text-dark);
    background: rgba(248, 250, 252, 0.95);
}

.drop-msg { text-align: center; color: var(--text-dark); }
.drop-msg i { font-size: 64px; margin-bottom: 20px; color: var(--text-muted); }
.drop-msg h2 { font-size: 1.5rem; font-weight: 600; }

.hidden { display: none !important; }
