/* ========================================
   HTML to ePub Converter - Styles
   Brand Colors:
     Golden Grass: #E3AE28 (primary)
     Bleached Cedar: #241826 (text)
     Alabaster: #F8F7F7 (background)
     Cabaret: #D33E5D (dark accent)
     Cold Turkey: #D1B0B3 (light accent)
   ======================================== */

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

html {
    font-size: 16px;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #F8F7F7;
    color: #241826;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

/* Header */
.app-header {
    text-align: center;
    padding: 2.5rem 1rem 1.5rem;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #E3AE28;
    margin-bottom: 0.25rem;
}

.app-header .subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: #241826;
    opacity: 0.7;
}

/* Main */
main {
    flex: 1;
    max-width: 680px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(36, 24, 38, 0.06);
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #241826;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    background: #E3AE28;
    color: #fff;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

/* Form */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
    color: #241826;
}

.form-group .optional {
    font-weight: 400;
    color: #D1B0B3;
    font-size: 0.8rem;
}

.form-group input[type="url"],
.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    border: 1.5px solid #D1B0B3;
    border-radius: 8px;
    background: #F8F7F7;
    color: #241826;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #E3AE28;
    box-shadow: 0 0 0 3px rgba(227, 174, 40, 0.15);
}

.form-group input::placeholder {
    color: #D1B0B3;
}

.hint {
    font-size: 0.78rem;
    color: #241826;
    opacity: 0.5;
    margin-top: 0.3rem;
}

.hint code {
    background: rgba(227, 174, 40, 0.12);
    padding: 0.1em 0.35em;
    border-radius: 4px;
    font-size: 0.85em;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

/* Toggle */
.naming-toggle {
    margin-bottom: 1rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    accent-color: #E3AE28;
    width: 1rem;
    height: 1rem;
}

/* Custom naming section */
.custom-naming {
    border: 1.5px solid #D1B0B3;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    background: rgba(209, 176, 179, 0.06);
}

/* Buttons */
.btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.65rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.97);
}

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

.btn.primary {
    background: #E3AE28;
    color: #fff;
}

.btn.primary:hover:not(:disabled) {
    background: #cfa023;
}

.btn.secondary {
    background: transparent;
    color: #241826;
    border: 1.5px solid #D1B0B3;
}

.btn.secondary:hover:not(:disabled) {
    background: rgba(209, 176, 179, 0.12);
}

.button-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Preview - Metadata */
#book-metadata {
    margin-bottom: 1.25rem;
}

.meta-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 1rem;
    font-size: 0.9rem;
}

.meta-label {
    font-weight: 600;
    color: #E3AE28;
    white-space: nowrap;
}

.meta-value {
    color: #241826;
}

/* Preview - Table of Contents */
.preview-toc {
    margin-top: 1rem;
}

.preview-toc h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #241826;
}

.preview-part {
    font-size: 0.8rem;
    font-weight: 600;
    color: #D33E5D;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    padding-left: 0.25rem;
}

.preview-chapter {
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    color: #241826;
}

.preview-chapter:nth-child(even) {
    background: rgba(227, 174, 40, 0.04);
}

.preview-chapter.special {
    color: #D33E5D;
    font-weight: 500;
}

.chapter-count {
    font-size: 0.8rem;
    color: #241826;
    opacity: 0.5;
    margin-top: 0.5rem;
}

/* Progress */
.progress-container {
    margin-top: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(209, 176, 179, 0.3);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #E3AE28, #D33E5D);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: #241826;
    opacity: 0.7;
    margin-top: 0.5rem;
}

/* Download */
#download-info {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: #241826;
}

/* Error */
.error-card {
    border-left: 4px solid #D33E5D;
}

.error-card h2 {
    color: #D33E5D;
}

#error-message {
    font-size: 0.9rem;
    color: #241826;
    margin-bottom: 1rem;
    word-break: break-word;
}

/* Footer */
.app-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.78rem;
    color: #241826;
    opacity: 0.4;
}

/* Responsive */
@media (max-width: 600px) {
    .app-header {
        padding: 1.5rem 1rem 1rem;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 1.25rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .button-row {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}
