/* ============================================================
   EPUB Generator - Minimalist Design (High Contrast)
   ============================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 20px;
    color: #111;
}

/* ============================================================
   CONTAINER
   ============================================================ */

.container {
    max-width: 580px;
    width: 100%;
    padding: 20px 20px 80px;
}

.logo {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 8px;
    text-align: center;
}

h1 {
    font-size: 38px;
    font-weight: 300;
    letter-spacing: -1px;
    margin-bottom: 12px;
    text-align: center;
    color: #111;
}

.subtitle {
    color: #555;
    font-size: 15px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 400;
}

/* ============================================================
   UPLOAD ZONE
   ============================================================ */

.upload-zone {
    border: 2px dashed #bbb;
    border-radius: 8px;
    padding: 30px 25px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    background: #e8f5e9;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #4caf50;
    background: #c8e6c9;
}

.upload-zone input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 32px;
    margin-bottom: 14px;
    opacity: 0.5;
}

.upload-text {
    font-size: 14px;
    color: #555;
}

.upload-text strong {
    color: #111;
}

.upload-hint {
    font-size: 12px;
    color: #888;
    margin-top: 10px;
}

/* ============================================================
   FILE INFO
   ============================================================ */

.file-info {
    display: none;
    background: #f0f0f0;
    border-radius: 5px;
    padding: 15px 20px;
    margin-bottom: 20px;
    font-size: 13px;
    color: #333;
    border: 1px solid #ddd;
}

.file-info.show {
    display: block;
}

.file-info ul {
    margin: 10px 0 0 20px;
    font-size: 12px;
    color: #555;
}

.file-info li {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.delete-file-btn {
    background: #eee;
    border: 1px solid #ccc;
    border-radius: 3px;
    width: 22px;
    height: 22px;
    font-size: 14px;
    line-height: 1;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-file-btn:hover {
    background: #ffebee;
    border-color: #e57373;
    color: #c62828;
}

/* ============================================================
   OUTPUT MODE (Multi-file)
   ============================================================ */

.output-mode {
    display: none;
    margin-bottom: 25px;
}

.output-mode.show {
    display: block;
}

.output-mode>label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 12px;
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mode-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    color: #444;
    transition: all 0.2s;
    background: #fafafa;
}

.mode-option:hover {
    border-color: #111;
}

.mode-option input {
    margin-top: 3px;
    accent-color: #111;
}

.mode-option strong {
    color: #111;
}

/* ============================================================
   DIVIDER
   ============================================================ */

.divider {
    text-align: center;
    color: #999;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 15px 0;
}

/* ============================================================
   FORMAT OPTIONS
   ============================================================ */

.format-options {
    display: flex;
    gap: 25px;
    margin-bottom: 8px;
    justify-content: center;
}

.format-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    font-weight: 400;
}

.format-option input {
    accent-color: #111;
}

.format-detected {
    display: none;
    text-align: center;
    font-size: 12px;
    color: #111;
    margin-bottom: 8px;
}

.format-detected.show {
    display: block;
}

/* ============================================================
   TEXTAREA
   ============================================================ */

textarea {
    width: 100%;
    height: 140px;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 14px 16px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    resize: none;
    transition: all 0.2s;
    background: #fff;
}

textarea:focus {
    outline: none;
    border-color: #7e57c2;
}

/* ============================================================
   OPTIONS (Title & Filename)
   ============================================================ */

.options {
    margin-top: 30px;
}

.option-group {
    margin-bottom: 25px;
}

.option-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    margin-bottom: 10px;
}

.option-group input[type="text"] {
    width: 100%;
    border: none;
    border-bottom: 2px solid #ddd;
    padding: 8px 4px;
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    background: transparent;
    transition: all 0.2s;
    color: #111;
}

.option-group input[type="text"]:focus {
    outline: none;
    border-bottom-color: #7e57c2;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: #555;
    cursor: pointer;
}

.checkbox-label input {
    accent-color: #111;
}

/* Metadata textarea (smaller than main textarea) */
.metadata-textarea {
    width: 100%;
    height: 80px;
    border: 2px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    resize: none;
    transition: all 0.2s;
    background: #fff;
}

.metadata-textarea:focus {
    outline: none;
    border-color: #111;
}

/* Collapsible advanced metadata */
.metadata-advanced {
    margin-bottom: 25px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fafafa;
}

.metadata-advanced summary {
    padding: 12px 15px;
    font-size: 12px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    user-select: none;
}

.metadata-advanced summary:hover {
    color: #111;
}

.metadata-advanced[open] summary {
    border-bottom: 1px solid #eee;
}

.metadata-advanced .option-group {
    padding: 0 15px;
    margin-bottom: 15px;
}

.metadata-advanced .option-group:first-of-type {
    margin-top: 15px;
}

.metadata-advanced .option-group:last-child {
    margin-bottom: 15px;
}

/* Cover Image Upload */
.cover-upload-area {
    position: relative;
    width: 120px;
    height: 160px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
}

.cover-upload-area:hover {
    border-color: #7e57c2;
    background: rgba(126, 87, 194, 0.05);
}

.cover-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.cover-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.cover-text {
    font-size: 10px;
    text-align: center;
    padding: 0 8px;
}

.cover-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-cover {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.remove-cover:hover {
    background: rgba(200, 0, 0, 0.8);
}

/* ============================================================
   STATUS & PROGRESS
   ============================================================ */

.status {
    display: none;
    padding: 14px 18px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
}

.status.show {
    display: block;
}

.status.success {
    background: #e8f5e9;
    color: #2e7d32;
}

.status.error {
    background: #ffebee;
    color: #c62828;
}

.status.info {
    background: #e3f2fd;
    color: #1565c0;
}

.progress-container {
    display: none;
    margin-bottom: 20px;
}

.progress-container.show {
    display: block;
}

.progress-bar {
    height: 6px;
    background: #eee;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: #111;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
    text-align: center;
}

/* ============================================================
   GENERATE BUTTON
   ============================================================ */

.generate-btn {
    width: 100%;
    padding: 18px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
}

.generate-btn:hover:not(:disabled) {
    background: #333;
    transform: translateY(-1px);
}

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

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

.footer {
    margin-top: 35px;
    text-align: center;
    font-size: 12px;
    color: #999;
    padding-bottom: 10px;
}

.footer-link {
    text-align: center;
    font-size: 11px;
    padding-bottom: 80px;
    margin-top: 5px;
}

.footer-link a {
    color: #7eb8da;
    text-decoration: none;
}

.footer-link a:hover {
    text-decoration: underline;
}

/* ============================================================
   OPTIONS PANEL (Progressive Reveal)
   ============================================================ */

.options-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.options-panel.show {
    max-height: 1000px;
    opacity: 1;
    margin-top: 30px;
}

/* ============================================================
   FIXED BUTTON BAR
   ============================================================ */

.fixed-button-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 20px;
    background: rgba(255, 220, 100, 0.50);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-top: 1px solid rgba(200, 170, 50, 0.3);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 100;
    display: flex;
    justify-content: center;
    gap: 12px;
    transition: box-shadow 0.3s ease;
}

.fixed-button-bar.scrolled {
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 -25px 50px -5px rgba(0, 0, 0, 0.25);
}

.fixed-button-bar .generate-btn {
    width: auto;
    padding: 12px 30px;
    font-size: 13px;
}

.fixed-button-bar .sample-btn {
    width: auto;
    padding: 12px 20px;
    font-size: 13px;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fixed-button-bar .sample-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(106, 17, 203, 0.3);
}

.fixed-button-bar .download-btn {
    width: auto;
    padding: 12px 30px;
    font-size: 13px;
    background: #90EE90;
    color: #333;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fixed-button-bar .download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(144, 238, 144, 0.5);
}

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
    .container {
        padding: 15px 10px 70px;
        max-width: 100%;
    }

    body {
        padding: 10px 0;
    }
}