/* ==========================================================================
   PREMIUM EDITORIAL E-INK STYLING // HIGH CONTRAST MONOSPACE & SANS
   ========================================================================== */

:root {
    --bg-paper: #fcfcf9;
    --bg-panel: #ffffff;
    --text-primary: #111111;
    --text-muted: #555555;
    --border-color: #111111;
    
    --shadow-color: #111111;
    --shadow-main: 3px 3px 0px var(--shadow-color);
    --shadow-hover: 1px 1px 0px var(--shadow-color);
    
    --font-mono: 'Space Mono', 'Consolas', monospace;
    --font-sans: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
    --bg-paper: #121212;
    --bg-panel: #1a1a1a;
    --text-primary: #e5e5e2;
    --text-muted: #9c9c99;
    --border-color: #e5e5e2;
    
    --shadow-color: #e5e5e2;
}

/* Global resets & cursor fixes */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-paper);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
    transition: background-color 0.15s ease, color 0.15s ease;
    cursor: default; /* Resolves clicking/caret bugs on the page */
}

/* Make sure text cursor is only visible where appropriate */
input[type="url"], textarea {
    cursor: text;
}

button, a, .format-card, .btn-paste-action {
    cursor: pointer;
}

/* Main Container */
.eink-container {
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Header */
.eink-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid var(--border-color);
    padding-bottom: 12px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-weight: 700;
}

.brand-logo {
    font-size: 18px;
}

.theme-switch-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    transition: background 0.1s, color 0.1s;
}

.theme-switch-btn:hover {
    background: var(--text-primary);
    color: var(--bg-paper);
}

/* Panels / Containers */
.eink-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-main);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Main Download panel styles */
.panel-heading {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-family: var(--font-mono);
}

.panel-subtext {
    font-size: 13px;
    color: var(--text-muted);
}

/* Input group */
.input-group {
    display: flex;
    border: 1px solid var(--border-color);
    background: var(--bg-paper);
    padding: 2px;
}

#url-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
    width: 100%;
}

#url-input::placeholder {
    color: var(--text-muted);
    opacity: 0.6;
}

.btn-paste-action {
    background: var(--text-primary);
    color: var(--bg-paper);
    border: none;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    padding: 0 16px;
    transition: background 0.1s;
}

.btn-paste-action:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
}

/* Action buttons */
.quick-action-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
}

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

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-paper);
    border: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    padding: 12px;
    box-shadow: var(--shadow-main);
    transition: transform 0.05s, box-shadow 0.05s;
}

.btn-primary:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
}

.btn-primary:active, .btn-secondary:active {
    transform: translate(2px, 2px);
    box-shadow: var(--shadow-hover);
}

.btn-secondary {
    background: var(--bg-panel);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    padding: 12px 18px;
    box-shadow: var(--shadow-main);
    transition: transform 0.05s, box-shadow 0.05s;
}

.btn-secondary:hover {
    background: var(--text-primary);
    color: var(--bg-paper);
}

/* Status Indicator */
.status-indicator {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-bullet {
    font-size: 16px;
    color: var(--text-primary);
}

/* Loading panel */
.loading-panel {
    align-items: center;
    padding: 16px;
}

.loading-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error panel */
.error-panel {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    border-style: dashed;
    padding: 16px;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
}

.error-icon {
    font-weight: 700;
}

.btn-dismiss {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
}

.btn-dismiss:hover {
    text-decoration: underline;
}

/* Details Panel (Dynamic) */
.details-panel {
    gap: 20px;
}

.details-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 8px;
}

.details-title {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
}

.media-preview-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.media-headline {
    font-size: 17px;
    font-weight: 700;
}

.media-meta-line {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.formats-list-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.formats-list-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.formats-clean-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.format-card {
    border: 1px solid var(--border-color);
    background: var(--bg-paper);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.1s, color 0.1s;
}

.format-card:hover {
    background: var(--text-primary);
    color: var(--bg-paper);
}

.format-res {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 13px;
}

.format-ext {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.format-card:hover .format-ext {
    color: var(--bg-paper);
    opacity: 0.8;
}

/* History panel */
.panel-header-simple {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 8px;
}

.panel-label {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-decoration: underline;
}

.btn-clear:hover {
    color: var(--text-primary);
}

.history-list-simple {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 4px 0;
}

.history-item-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 65%;
    color: var(--text-muted);
}

.history-item-actions {
    display: flex;
    gap: 12px;
}

.btn-re-dl, .btn-re-use {
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
}

.btn-re-dl:hover, .btn-re-use:hover {
    text-decoration: underline;
}

.history-empty {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

/* ==========================================================================
   EDITORIAL SEO STYLING // HIGH-END LAYOUT
   ========================================================================== */

.editorial-seo-section {
    border-top: 1px solid var(--border-color);
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.editorial-heading {
    font-size: 17px;
    font-weight: 700;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: -0.2px;
}

/* Steps columns */
.steps-editorial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.step-editorial-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.step-index {
    font-family: var(--font-mono);
    font-size: 24px;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 2px;
    display: inline-block;
    width: 36px;
    line-height: 1;
}

.step-name {
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-mono);
    margin-top: 4px;
}

.step-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Split layout (Features & FAQ side-by-side) */
.editorial-seo-section.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

@media (max-width: 600px) {
    .editorial-seo-section.split-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

.layout-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.features-editorial-list {
    list-style: square;
    padding-left: 18px;
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.features-editorial-list li {
    color: var(--text-muted);
}

.features-editorial-list li strong {
    color: var(--text-primary);
}

/* FAQ list */
.faq-editorial-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.faq-editorial-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.faq-question {
    font-size: 13px;
    font-weight: 700;
}

.faq-answer {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Footer */
.eink-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1.5px solid var(--border-color);
    padding-top: 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

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

/* Auth Overlay Gate */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-paper);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.auth-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-main);
    padding: 32px;
    width: 90%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: center;
}

.auth-title {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
}

.auth-text {
    font-size: 13px;
    color: var(--text-muted);
}

.auth-input-row {
    display: flex;
    border: 1px solid var(--border-color);
    background: var(--bg-paper);
    padding: 2px;
}

#auth-password {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
    width: 100%;
}

#btn-auth-submit {
    background: var(--text-primary);
    color: var(--bg-paper);
    border: none;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 12px;
    padding: 0 18px;
    cursor: pointer;
    transition: background 0.1s;
}

#btn-auth-submit:hover {
    background: var(--bg-panel);
    color: var(--text-primary);
}

.auth-error-msg {
    color: #cc0000;
    font-size: 12px;
    font-family: var(--font-mono);
}
