/* ═══ Cover Tool Styles ═══ */

/* ── Font Imports ── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=EB+Garamond:ital,wght@0,400;0,700;1,400&family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Lora:ital,wght@0,400;0,700;1,400&family=Cormorant+Garamond:ital,wght@0,400;0,700;1,400&family=Crimson+Text:ital,wght@0,400;0,700;1,400&family=Merriweather:ital,wght@0,400;0,700;1,400&family=Source+Serif+4:ital,wght@0,400;0,700;1,400&display=swap');

.cover-tool-page {
    min-height: 100vh;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
}

/* ── Top Action Bar ── */
.cover-tool-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 2px solid #000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    z-index: 100;
    height: 58px;
}

.cover-tool-bar .bar-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    font-weight: 900;
    pointer-events: none;
}

.cover-tool-bar .btn-bar {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    border: 2px solid #000;
    border-radius: 10px;
    padding: 6px 14px;
    cursor: pointer;
    background: #fff;
    color: #000;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    -webkit-user-select: none;
    user-select: none;
    transition: background 0.15s ease;
}

.cover-tool-bar .btn-bar:active { background: #f0f0f0; }

.cover-tool-bar .btn-bar.btn-export {
    background: #000;
    color: #fff;
}
.cover-tool-bar .btn-bar.btn-export:active { background: #333; }

/* ── Page Wrapper (scrollable) ── */
.cover-tool-body {
    padding-top: 58px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* ── A4 Preview Wrapper ── */
.a4-preview-wrap {
    padding: 24px 16px 40px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.a4-scale-container {
    transform-origin: top center;
    filter: blur(0.8px);
}

/* ── A4 Page ── */
.a4-page {
    width: 210mm;
    height: 297mm;
    background: white;
    box-sizing: border-box;
    padding: 12mm;
    position: relative;
}

.page-border {
    border: 6px double #1a1a1a;
    height: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    position: relative;
}

/* ── Cover Content Typography ── */
.cover-college-name {
    text-align: center;
    text-transform: uppercase;
    color: #000;
    font-family: 'Orbitron', sans-serif;
    font-size: 24px;
    font-weight: bold;
    letter-spacing: 1px;
    line-height: 1.4;
    margin-top: 10px;
    margin-bottom: 14px;
    width: 100%;
}

.cover-dept-name {
    text-align: center;
    text-transform: capitalize;
    color: #333;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 24px;
    width: 100%;
    font-style: italic;
}

.cover-logo-container {
    margin: 0 0 36px 0;
    height: 280px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.cover-logo-container img {
    max-width: 280px;
    max-height: 280px;
    object-fit: contain;
}

.cover-middle {
    text-align: center;
    margin-bottom: 18px;
}

.cover-subject-name {
    font-size: 36px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 12px;
    border-bottom: 2px solid #000;
    padding-bottom: 8px;
    display: inline-block;
}

.cover-subject-code {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    letter-spacing: 1px;
}

.cover-semester {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    letter-spacing: 1px;
    margin-top: 8px;
}

.cover-submission {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    margin-top: auto;
    margin-bottom: 28px;
}

.cover-submitted-to { text-align: left; }
.cover-submitted-by { text-align: right; }

.cover-role-title {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555;
    margin-bottom: 10px;
    font-weight: normal;
    border-bottom: 1px solid #999;
    padding-bottom: 4px;
    display: block;
}

.cover-person-name {
    font-size: 22px;
    font-weight: bold;
    margin: 6px 0;
    color: #000;
}

.cover-person-detail {
    font-size: 16px;
    margin: 5px 0;
    color: #222;
}

.cover-academic-session {
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 2px;
    text-transform: uppercase;
    border-top: 1px solid #ccc;
    padding-top: 14px;
    width: 80%;
}

/* ── Edit Form Panel ── */
.edit-panel {
    display: none;
    width: 100%;
    max-width: 600px;
    padding: 74px 16px 100px;   /* 74px top = 58px bar + 16px breathing room */
    flex-direction: column;
    gap: 0;
}

.edit-panel.visible {
    display: flex;
}

.edit-section-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    padding: 18px 0 8px;
    border-top: 1px solid var(--border-light);
    margin-top: 8px;
}

.edit-section-label:first-child {
    border-top: none;
    margin-top: 0;
    padding-top: 4px;
}

.edit-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.edit-field label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #000;
}

.edit-field input[type="text"],
.edit-field select {
    font-family: var(--font-body);
    font-size: 0.95rem;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 11px 16px;
    background: var(--surface-color);
    color: var(--text-primary);
    width: 100%;
    transition: border-color 0.2s ease;
    -webkit-user-select: auto;
    user-select: auto;
}

.edit-field input[type="text"]:focus,
.edit-field select:focus {
    outline: none;
    border-color: #000;
}

/* Logo Upload */
.logo-upload-area {
    border: 2px dashed var(--border-light);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease;
    background: var(--surface-color);
}

.logo-upload-area:hover { border-color: #000; }

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

.logo-preview-thumb {
    width: 72px;
    height: 72px;
    object-fit: contain;
    border-radius: 10px;
    border: 2px solid var(--border-light);
    display: none;
}

.logo-upload-icon {
    font-size: 32px;
    color: var(--text-secondary);
}

.logo-upload-hint {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Font Combos */
.font-combo-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.font-combo-option {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid var(--border-light);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.15s ease;
    background: var(--surface-color);
}

.font-combo-option.selected {
    border-color: #000;
    background: #f9f9f9;
}

.font-combo-option input[type="radio"] { display: none; }

.font-combo-check {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-light);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.font-combo-option.selected .font-combo-check {
    border-color: #000;
    background: #000;
}

.font-combo-option.selected .font-combo-check::after {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
}

.font-combo-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.font-combo-name {
    font-size: 0.85rem;
    font-weight: 800;
    color: #000;
}

.font-combo-sample {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

/* Proceed button */
.btn-proceed {
    width: 100%;
    padding: 16px;
    background: #000;
    color: #fff;
    border: 2px solid #000;
    border-radius: 14px;
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    cursor: pointer;
    margin-top: 16px;
}

.btn-proceed:active { background: #333; }

/* ── Coin Deduction Modal ── */
.coin-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
    align-items: flex-end;
    justify-content: center;
}

.coin-modal-overlay.active { display: flex; }

.coin-modal {
    background: #fff;
    border: 2px solid #000;
    border-radius: 24px 24px 0 0;
    padding: 28px 24px 36px;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.coin-modal-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: 1px;
}

.coin-modal-body {
    font-size: 0.9rem;
    color: #333;
    line-height: 1.6;
}

.coin-modal-cost {
    background: #fff9c4;
    border: 2px solid #000;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 800;
    font-size: 1rem;
}

.coin-modal-actions {
    display: flex;
    gap: 10px;
}

.coin-modal-actions button {
    flex: 1;
    padding: 14px;
    border-radius: 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 800;
    border: 2px solid #000;
    cursor: pointer;
}

.btn-modal-cancel { background: #fff; color: #000; }
.btn-modal-cancel:active { background: #f0f0f0; }
.btn-modal-confirm { background: #000; color: #fff; }
.btn-modal-confirm:active { background: #333; }

/* ── Print ── */
@media print {
    @page { size: A4; margin: 0; }
    body { background: white; margin: 0; padding: 0; }

    .cover-tool-bar,
    .edit-panel,
    .a4-preview-wrap { display: block !important; padding: 0 !important; }

    .a4-scale-container { transform: none !important; }

    .a4-page {
        margin: 0;
        padding: 12mm;
        box-shadow: none;
        width: 210mm;
        height: 297mm;
        overflow: hidden;
        page-break-after: avoid;
    }

    .page-border { border-width: 4px; }
}
