/* style.css */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --success: #16a34a;
    --error: #dc2626;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5em;
    color: var(--primary);
    margin-bottom: 10px;
}

header p {
    color: var(--text-light);
    font-size: 1.1em;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card h2,
.card h3 {
    margin-bottom: 20px;
    color: var(--text);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--primary);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    caret-color: transparent;   /* contenteditable (for right-click Paste) but no visible caret */
    margin-bottom: 20px;
    background: #f0f9ff;
}

.upload-area:hover {
    border-color: var(--primary-hover);
    background: #e0f2fe;
}

.upload-area.dragover {
    border-color: var(--success);
    background: #f0fdf4;
}

.upload-icon {
    width: 60px;
    height: 60px;
    color: var(--primary);
    margin-bottom: 10px;
}

.upload-area p {
    color: var(--text-light);
    margin-bottom: 10px;
}

.upload-area .upload-hint {
    font-size: 0.82em;
    color: #94a3b8;
    margin-top: -4px;
    margin-bottom: 0;
}

.upload-area kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 0.9em;
    font-family: inherit;
    color: #475569;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-bottom-width: 2px;
    border-radius: 4px;
}

/* Brief confirmation flash when a PDF is pasted in (reuses the drop look). */
.upload-area.pasted {
    border-color: var(--success);
    background: #f0fdf4;
}

/* Multi-select checkbox dropdown ("What to look for") */
.multiselect { position: relative; width: 100%; }
.ms-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 1em;
    color: #1e293b;
    text-align: left;
}
.ms-toggle:hover { border-color: var(--primary); }
.ms-toggle #lookForSummary {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ms-caret { color: #64748b; flex: none; transition: transform 0.15s; }
.multiselect.open .ms-caret { transform: rotate(180deg); }
.ms-panel {
    position: absolute;
    z-index: 50;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    padding: 4px;
    max-height: 300px;
    overflow-y: auto;
}
.ms-panel[hidden] { display: none; }
.ms-opt {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95em;
    color: #1e293b;
}
.ms-opt:hover { background: #f1f5f9; }
.ms-opt input { cursor: pointer; }
.ms-soon {
    margin-left: auto;
    font-size: 0.72em;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #b45309;
    background: #fef3c7;
    border-radius: 10px;
    padding: 1px 7px;
}

.file-info {
    background: #f1f5f9;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Config Grid */
.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.config-item label {
    display: block;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--text);
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-group input[type="radio"] {
    margin-right: 5px;
}

.radio-group label {
    display: inline;
    margin: 0;
    font-weight: 400;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:disabled {
    background: var(--border);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-download {
    background: var(--success);
    color: white;
    width: 100%;
    margin-bottom: 10px;
}

.btn-download:hover {
    background: #15803d;
}

/* Loading */
.spinner {
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

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

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 1.8em;
    font-weight: bold;
}

/* Info Box */
.info-box {
    background: #f8fafc;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid var(--primary);
}

.info-box p {
    margin: 8px 0;
    font-size: 0.95em;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f1f5f9;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: #f8fafc;
}

/* Canvas */
canvas {
    max-width: 100%;
    background: white;
    border-radius: 6px;
}

/* Downloads Grid */
.downloads-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

/* Error */
.error-section {
    border-left: 4px solid var(--error);
}

.error-section h3 {
    color: var(--error);
}

/* Responsive */
@media (max-width: 768px) {
    .config-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .tab-btn.active {
        border-left-color: var(--primary);
        border-bottom: none;
    }
}
