/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header styles */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.title {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    opacity: 0.9;
}

/* Main content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

/* Upload section */
.upload-section {
    width: 100%;
    max-width: 600px;
}

.upload-area {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border: 3px dashed #e1e5e9;
}

.upload-area:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.upload-area.dragover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-area h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #333;
}

.upload-area p {
    color: #666;
    margin-bottom: 25px;
}

.upload-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.upload-btn:disabled,
.upload-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Results section */
.results-section {
    background: white;
    border-radius: 20px;
    padding: 30px;
    width: 100%;
    max-width: 1400px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.results-section h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

/* Results header and actions */
.results-header {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

@media (min-width: 700px) {
    .results-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.file-info {
    /* Separate primary (filename) and secondary (status pill) */
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 24px; /* breathing room between filename and pill */
    align-items: center;
    margin-bottom: 20px;
    padding: 16px 18px;
    background: #f8f9ff;
    border-radius: 12px;
}

.filename {
    font-weight: 700;
    color: #5865e0; /* slightly stronger to signal primary info */
    font-size: 1.05rem;
    /* Keep long filenames from crowding the pill */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.slide-count {
    background: #667eea;
    color: white;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.filter-pill {
    background: #0ea5e9; /* sky-500 */
    color: white;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(14,165,233,0.25);
}

.extracted-content {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 20px;
}

.slide-content {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.slide-number {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 10px;
}

.slide-text {
    color: #555;
    line-height: 1.6;
    white-space: pre-wrap; /* Preserve line breaks and formatting */
}

/* Markdown table rendering */
.slide-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0 16px;
    font-variant-numeric: tabular-nums;
}
.slide-text thead th {
    background: #eef1ff;
    color: #333;
    font-weight: 600;
}
.slide-text th, .slide-text td {
    border: 1px solid #e1e5e9;
    padding: 6px 8px;
    vertical-align: top;
}
.slide-text tbody tr:nth-child(even) td {
    background: #fafbff;
}

.actions-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Subtle monospace for inline pipe-aligned text */
.inline-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
    font-size: 0.96em;
}

/* Toast notification */
/* (toast styles removed; using button label feedback instead) */


/* Notes separator styling */
.slide-text br + br + br + br {
    margin-top: 15px;
}

.download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: auto;
}

.download-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

/* Loading/progress styles */
.loading { color: white; width: 100%; max-width: 680px; margin: 0 auto; }
.progress-container {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.18);
}
.progress-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.progress-title { font-weight: 700; letter-spacing: 0.2px; }
.progress-percent { font-variant-numeric: tabular-nums; font-weight: 700; }
.progress-bar-wrap {
    position: relative;
    height: 10px;
    background: rgba(255,255,255,0.25);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, #ffdd05, #ffd54d, #fff07a);
    border-radius: 999px;
    transition: width 160ms ease;
}
.progress-bar.indeterminate {
    width: 35% !important;
    animation: indet 1.2s ease-in-out infinite;
}
@keyframes indet {
    0% { transform: translateX(-120%); }
    50% { transform: translateX(30%); }
    100% { transform: translateX(140%); }
}
.progress-subtext { margin-top: 10px; opacity: 0.9; font-size: 0.95rem; }

/* Workspace variables */
:root { --slide-min: 420px; --grid-gap: 16px; }

/* Error styles */
.error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #f5c6cb;
}

/* Tabs */
.tabs {
    display: inline-flex;
    gap: 8px;
    background: #f3f4f8;
    padding: 6px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.tab-btn {
    border: none;
    background: transparent;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
    color: #556;
    cursor: pointer;
}

.tab-btn.active {
    background: white;
    color: #222;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Light table slides grid */
.slides-panel { display: block; }

.slides-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--slide-min), 1fr));
    gap: var(--grid-gap);
}

.slide-card {
    position: relative;
    background: #fff;
    border: 1px solid #e4e7ec;
    border-radius: 12px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.06);
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.slide-card-inner {
    position: absolute;
    inset: 0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.slide-card-number {
    font-weight: 700;
    color: #667eea;
    font-size: 0.9rem;
}

.hidden-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444; /* red-500 */
    color: #fff;
    padding: 4px 8px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.75rem;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

.slide-card-content {
    margin-top: 6px;
    /* Allow scrollbars when content exceeds available space */
    overflow: auto;
    overflow-x: hidden; /* prevent horizontal bar */
    /* Take remaining height inside the flex column */
    flex: 1 1 auto;
    /* Required for flex children to be scrollable in column layout */
    min-height: 0;
    /* Reserve gutter so presence of scrollbar is visually hinted */
    scrollbar-gutter: stable;
    color: #444;
    font-size: 0.92rem;
    line-height: 1.4;
}

/* Force a visible vertical scrollbar when overflowing */
.slide-card-content.has-overflow {
    overflow-y: scroll; /* always show the bar even when idle */
}

/* Cross-browser scrollbar styling */
.slide-card-content {
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: #94a3b8 #eef2ff; /* thumb track */
}
.slide-card-content::-webkit-scrollbar {
    width: 10px;
}
.slide-card-content::-webkit-scrollbar-track {
    background: #eef2ff;
}
.slide-card-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 6px;
}

.slide-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(0,0,0,0.06);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.slide-copy:hover { background: rgba(0,0,0,0.12); }
.slide-copy:disabled { opacity: 0.5; cursor: not-allowed; }

/* Locked styles */
.slide-locked .slide-card-inner { filter: blur(6px); }
.slide-locked .locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0.8));
}
.locked-badge {
    background: #ffd166;
    color: #4a3b00;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
}
.unlock-cta { margin-top: 16px; width: 100%; }
.locked-notice { display: none; margin-bottom: 12px; color: #666; }

/* Raw view */
.raw-panel {
    background: #fafbff;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 16px;
}
.raw-content { max-height: 520px; overflow: auto; }
.raw-content .slide-block {
    background: #fff;
    border: 1px solid #eceff5;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
}
.raw-content .slide-block h4 { margin-bottom: 6px; color: #667eea; }

.slide-card-content table,
.raw-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0 10px;
    font-variant-numeric: tabular-nums;
}
.slide-card-content thead th,
.raw-content thead th { background: #eef1ff; color: #333; font-weight: 600; }
.slide-card-content th, .slide-card-content td,
.raw-content th, .raw-content td { border: 1px solid #e1e5e9; padding: 6px 8px; vertical-align: top; }
.slide-card-content tbody tr:nth-child(even) td,
.raw-content tbody tr:nth-child(even) td { background: #fafbff; }

/* View toolbar (removed) */

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .upload-area {
        padding: 30px 20px;
    }
    
    .results-section {
        padding: 20px;
    }
    
    .file-info {
        grid-template-columns: 1fr; /* stack filename and status */
        row-gap: 10px;
        text-align: left;
    }
    .slide-count { justify-self: start; }
}

/* Additions for SEO/marketing content (kept subtle) */
.seo-content {
    background: #ffffff;
    margin: 32px auto 0;
    padding: 24px;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    max-width: 1100px;
}

.seo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 16px;
}

.seo-content h2 {
    font-size: 1.5rem;
    margin: 0 0 10px 0;
}

.feature-list {
    list-style: disc;
    padding-left: 20px;
}
.feature-list li { margin: 6px 0; }

.howto-list { padding-left: 20px; }
.howto-list li { margin: 6px 0; }

.faq details {
    border: 1px solid #e8ebef;
    border-radius: 10px;
    padding: 12px 14px;
    margin: 10px 0;
    background: #f9fbff;
}
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin-top: 8px; }

.meta-note {
    color: #6b7280;
    font-size: 0.95rem;
}

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