/* =====================================================================
   MARANTZLATOR EDITORIAL DESIGN SYSTEM & STYLING
   ===================================================================== */

:root {
    /* Color Palette (Aesthetics matching tighebrary.io) */
    --bg-base: #fcfbfa;            /* Soft book-paper cream */
    --bg-surface: #ffffff;         /* Pure white cards */
    --border-color: #e4e4e7;       /* Thin zinc-200 border */
    --border-hover: #d4d4d8;       /* Thin zinc-300 border */
    
    /* Accents mapping to tighebrary.io link colors */
    --color-primary: #007d77;      /* Deep Teal (from Code links) */
    --color-primary-hover: #005f5a;
    --color-primary-light: rgba(0, 125, 119, 0.05);
    
    --color-accent: #5e74cc;       /* Indigo/Blue (from Politics links) */
    --color-narrative: #ac62b7;    /* Purple (from Narrative links) */
    --color-news: #d8538c;         /* Pink/Rose (from News links) */
    --color-comedy: #007ec4;       /* Cyan (from Comedy links) */
    
    /* Semantic mapping */
    --color-success: #007d77;      /* Success uses Teal */
    --color-warning: #ac62b7;      /* Warning uses Purple */
    --color-danger: #d8538c;       /* Danger uses Pink */
    --color-info: #5e74cc;         /* Info uses Indigo */
    
    --text-primary: #18181b;       /* Zinc-900 */
    --text-secondary: #52525b;     /* Zinc-600 */
    --text-muted: #71717a;         /* Zinc-500 */
    
    /* Layout & FX */
    --radius-lg: 8px;              /* Crisp, clean borders */
    --radius-md: 6px;
    --radius-sm: 4px;
    --shadow-subtle: 0 1px 3px rgba(24, 24, 27, 0.04);
    --transition-smooth: all 0.2s ease-in-out;
}

/* Reset & Core Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* Header Styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--text-primary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2rem;
    color: var(--color-primary);
}

.logo-text h1 {
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    font-size: 2.2rem;
    letter-spacing: -0.5px;
    line-height: 1.1;
    color: var(--text-primary);
}

.logo-text p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-style: italic;
    margin-top: 0.25rem;
}

/* Status Badges */
.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 30px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.status-online {
    color: var(--color-primary);
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.status-offline {
    color: var(--text-muted);
}

.status-badge i {
    font-size: 0.55rem;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 460px 1fr;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Editorial Cards */
.glass-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-subtle);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(24, 24, 27, 0.01);
}

.card-header h2 {
    font-family: 'Lora', Georgia, serif;
    font-weight: 500;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.icon-accent {
    color: var(--color-primary);
}

.card-body {
    padding: 1.5rem;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.required {
    color: var(--color-danger);
}

.optional {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 400;
}

input[type="text"],
input[type="url"],
input[type="password"],
select,
textarea {
    width: 100%;
    background-color: #ffffff;
    border: 1px solid #d4d4d8; /* Zinc-300 */
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

/* Password Eye Overlay */
.password-group {
    position: relative;
    display: flex;
    align-items: center;
}

.password-group input {
    padding-right: 3rem;
}

.btn-toggle-pass {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    transition: var(--transition-smooth);
}

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

/* Input Icon Group */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input {
    padding-left: 2.75rem;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: 'Lora', Georgia, serif;
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-size: 1rem;
    border: none;
    width: 100%;
    transition: var(--transition-smooth);
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(24, 24, 27, 0.02);
    border-color: var(--border-hover);
}

/* Settings Card Drawer */
.settings-card {
    margin-bottom: 0;
}

.toggle-settings {
    cursor: pointer;
}

.toggle-icon {
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.collapsed {
    max-height: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
    opacity: 0;
    transition: var(--transition-smooth);
}

#settings-body {
    transition: max-height 0.4s ease-out, opacity 0.3s ease;
}

#settings-body:not(.collapsed) {
    max-height: 1200px;
    opacity: 1;
}

.settings-disclaimer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(94, 116, 204, 0.05);
    border: 1px solid rgba(94, 116, 204, 0.15);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--color-accent);
    margin-bottom: 1.5rem;
}

.settings-section-title {
    font-family: 'Lora', Georgia, serif;
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.25rem;
    margin: 1.5rem 0 1rem 0;
}

/* Pipeline Progress Area */
.progress-card {
    border-color: rgba(0, 125, 119, 0.3);
}

.hidden {
    display: none !important;
}

.job-id-tag {
    font-size: 0.8rem;
    background: rgba(24, 24, 27, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: monospace;
}

.progress-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

#progress-status-text {
    color: var(--text-primary);
}

#progress-percentage-text {
    color: var(--color-primary);
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
}

.progress-bar-container {
    height: 6px;
    background: rgba(24, 24, 27, 0.04);
    border-radius: 30px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background-color: var(--color-primary);
    border-radius: 30px;
    transition: width 0.4s ease;
}

/* Milestone Timeline Tracker */
.pipeline-milestones {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.pipeline-milestones::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: var(--border-color);
    z-index: 1;
}

.milestone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    z-index: 2;
    width: 18%;
    text-align: center;
    font-weight: 500;
}

.milestone-icon {
    font-size: 0.65rem;
    color: var(--text-muted);
    background-color: var(--bg-base);
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--bg-base);
}

.milestone.active {
    color: var(--color-narrative);
}

.milestone.active .milestone-icon {
    color: var(--color-narrative);
}

.milestone.completed {
    color: var(--color-primary);
}

.milestone.completed .milestone-icon {
    color: var(--color-primary);
}

/* Log Console */
.log-console-container {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.log-console-header {
    background: rgba(24, 24, 27, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-clear-logs {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-clear-logs:hover {
    color: var(--color-danger);
}

.log-console {
    background: #18181b; /* Dark zinc slate for console contrast */
    padding: 1rem;
    height: 180px;
    overflow-y: auto;
    font-family: SFMono-Regular, Consolas, Monaco, monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.log-line {
    color: #e4e4e7;
    word-break: break-all;
}

.log-line.text-muted { color: var(--text-muted); }
.log-line.text-success { color: var(--color-primary); } /* Teal */
.log-line.text-error { color: var(--color-danger); }    /* Rose */
.log-line.text-warning { color: #f59e0b; }

/* Episode Feed Display */
.feed-link-container {
    margin-bottom: 1.5rem;
    background: rgba(24, 24, 27, 0.01);
    padding: 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.feed-input-group {
    display: flex;
    gap: 0.5rem;
}

.feed-input-group input {
    background: #ffffff;
}

.btn-copy {
    width: auto;
    padding: 0 1rem;
    background-color: var(--color-primary-light);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-copy:hover {
    background-color: var(--color-primary);
    color: white;
}

.btn-refresh {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition-smooth);
}

.btn-refresh:hover {
    color: var(--text-primary);
    background-color: rgba(24, 24, 27, 0.04);
}

/* Episodes List */
.episode-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.list-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem 0;
    color: var(--text-muted);
}

.episode-item {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition-smooth);
}

.episode-item:hover {
    border-color: var(--color-primary);
}

.episode-main {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.episode-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.episode-title {
    font-family: 'Lora', Georgia, serif;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.episode-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

.episode-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.episode-play-btn {
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.episode-play-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: scale(1.05);
}

/* Tooltips */
.tooltip {
    cursor: help;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(24, 24, 27, 0.08);
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.visible {
    transform: translateY(0);
    opacity: 1;
}

.toast-success { border-color: var(--color-primary); color: var(--color-primary); }
.toast-error { border-color: var(--color-danger); color: var(--color-danger); }
.toast-info { border-color: var(--color-accent); color: var(--color-accent); }

/* Scrollbar tweaks */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #d4d4d8;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a1a1aa;
}
