/* ═══════════════════════════════════════════════════════
   Uploads + Settings Surfaces
   ═══════════════════════════════════════════════════════ */

.uploads-view,
.settings-view {
    overflow-y: auto;
    padding: 0 0 32px;
}

.uploads-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    padding: 12px 4px 0;
}

.uploads-header h2 {
    font-size: clamp(1.9rem, 2.7vw, 2.7rem);
    font-weight: var(--font-weight-extrabold);
    letter-spacing: -0.05em;
    margin-bottom: 6px;
}

.uploads-subtitle {
    color: var(--text-secondary);
    max-width: 720px;
    font-size: 0.98rem;
}

.uploads-stage {
    margin-bottom: 24px;
}

.uploads-ingest-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 18px;
    margin-bottom: 24px;
}

.uploads-ingest-card,
.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    padding: 22px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.uploads-ingest-card-primary {
    background:
        radial-gradient(circle at top right, var(--accent-light), transparent 36%),
        linear-gradient(180deg, color-mix(in srgb, var(--bg-card) 92%, white 8%), var(--bg-card));
}

.uploads-ingest-head {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}

.uploads-ingest-head h3 {
    font-size: 1.05rem;
    font-weight: var(--font-weight-extrabold);
    letter-spacing: -0.03em;
    margin-bottom: 4px;
}

.uploads-ingest-head p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    max-width: 420px;
}

.uploads-ingest-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-card);
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 16px 28px color-mix(in srgb, var(--accent) 20%, transparent);
}

.uploads-ingest-icon-soft {
    background: linear-gradient(135deg, var(--accent-light), rgba(255,255,255,0.18));
    color: var(--accent-text);
    box-shadow: none;
}

.drop-zone {
    border: 1.5px dashed color-mix(in srgb, var(--accent) 26%, var(--border-light));
    border-radius: var(--radius-container);
    padding: var(--space-10) var(--space-8);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent);
    background-color: color-mix(in srgb, var(--accent-light) 72%, transparent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.drop-zone-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: var(--radius-container);
    background: linear-gradient(135deg, var(--accent-light), rgba(255,255,255,0.16));
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone h4 {
    font-size: 1.05rem;
    font-weight: var(--font-weight-extrabold);
    margin-bottom: 6px;
}

.drop-zone p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.drop-zone-caption {
    margin-top: var(--space-3);
    font-size: var(--font-size-xs) !important;
    color: var(--text-tertiary) !important;
}

.drop-zone input[type="file"] {
    display: none;
}

.uploads-remote-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.google-connect-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--bg-secondary) 80%, transparent);
}

.google-connect-status {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    min-width: 0;
    overflow-wrap: anywhere;
}

.upload-progress {
    display: none;
    margin-bottom: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-field);
    padding: 14px 16px;
}

.upload-progress.active {
    display: block;
}

.progress-bar {
    height: 6px;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
    width: 0%;
}

.progress-text {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    margin-top: 10px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 18px;
}

.file-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-container);
    padding: 22px;
    transition: border-color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.file-card:hover {
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.file-card-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.file-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-card);
    background: linear-gradient(135deg, var(--accent-light), rgba(255,255,255,0.16));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.file-card-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent-text);
}

.file-card-info {
    flex: 1;
    min-width: 0;
}

.file-card-name {
    font-size: 1rem;
    font-weight: var(--font-weight-extrabold);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: -0.03em;
}

.file-card-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.file-card-name-row .file-card-name {
    flex: 1;
}

.file-name-edit-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.file-name-edit-btn:hover {
    color: var(--text-primary);
    border-color: var(--border);
    background: var(--bg-hover);
}

.file-name-input {
    width: 100%;
    min-width: 0;
    height: 32px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 0 10px;
    font: inherit;
    font-weight: var(--font-weight-bold);
}

.file-card-meta {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-top: 4px;
}

.file-card-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.file-card-stat {
    padding: 10px 12px;
    border-radius: var(--radius-card);
    background: color-mix(in srgb, var(--bg-secondary) 60%, transparent);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.file-card-stat strong {
    display: block;
    font-size: 1.05rem;
    font-weight: var(--font-weight-extrabold);
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.file-card-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.file-card-actions .btn {
    flex: 1;
}

.uploads-empty-state {
    min-height: 320px;
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-2xl);
    background: color-mix(in srgb, var(--bg-card) 76%, transparent);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.settings-card {
    min-height: 100%;
}

.settings-card .card-header {
    align-items: flex-start;
    margin-bottom: 18px;
}

.settings-card-subtitle {
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    max-width: 440px;
}

.settings-profile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.settings-profile-identity {
    display: flex;
    align-items: center;
    gap: 14px;
}

.settings-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-field);
    background: linear-gradient(145deg, var(--accent), var(--accent-strong));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: var(--font-weight-extrabold);
    font-size: 1.1rem;
    box-shadow: 0 16px 26px color-mix(in srgb, var(--accent) 18%, transparent);
}

.settings-profile-name {
    font-size: 1.08rem;
    font-weight: var(--font-weight-extrabold);
    letter-spacing: -0.03em;
}

.settings-profile-meta {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-top: 4px;
}

.settings-profile-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.settings-detail-card {
    padding: 14px 16px;
    border-radius: var(--radius-field);
    background: color-mix(in srgb, var(--bg-secondary) 62%, transparent);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-detail-card span {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.settings-detail-card strong {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.settings-detail-card-wide {
    grid-column: span 2;
}

.settings-card-wide {
    grid-column: span 2;
}

.settings-integration-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.settings-integration-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Admin Coaching list */
.coaching-list {
    margin-top: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.coaching-empty {
    color: var(--text-tertiary);
    font-size: var(--font-size-sm);
}

.coaching-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-card);
    background: var(--bg-surface);
}

.coaching-item-body {
    flex: 1;
    min-width: 0;
}

.coaching-q {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

.coaching-a {
    margin-top: 3px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

.settings-choice-row,
.settings-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.settings-form {
    margin-top: var(--space-2);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

@media (max-width: 980px) {
    .uploads-ingest-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .file-card-actions,
    .settings-choice-row {
        flex-direction: column;
    }

    .settings-profile-grid {
        grid-template-columns: 1fr;
    }

    .settings-detail-card-wide {
        grid-column: span 1;
    }
}

/* ═══════════════════════════════════════════════════════
   File Preview Modal
   ═══════════════════════════════════════════════════════ */

.file-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.file-preview-modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    width: 100%;
    max-width: min(1480px, 96vw);
    height: min(900px, 92vh);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: fade-in-up var(--transition-base);
    overflow: hidden;
}

.file-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-elevated);
}

.file-preview-header h3 {
    font-size: 1.1rem;
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-reader-count {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
}

.file-reader-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
}

.file-reader-search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0 12px;
    background: var(--bg-primary);
}

.file-reader-search svg {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.file-reader-search .input {
    border: 0;
    background: transparent;
    min-width: 0;
    padding-left: 0;
}

.file-preview-body {
    flex: 1;
    overflow: auto;
    position: relative;
    background: var(--bg-primary);
    min-height: 0;
}

.data-table-container {
    min-width: 100%;
}

.data-table {
    min-width: 100%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    text-align: left;
}

.data-table th, .data-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    white-space: nowrap;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: var(--font-weight-semibold);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 0 var(--border-light);
}

.data-table .row-number-col {
    position: sticky;
    left: 0;
    z-index: 12;
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    text-align: right;
    color: var(--text-tertiary);
    background: var(--bg-secondary);
    box-shadow: 1px 0 0 var(--border-light);
}

.data-table td.row-number-col {
    background: var(--bg-primary);
    font-weight: var(--font-weight-semibold);
}

.data-table th.row-number-col {
    z-index: 20;
}

.data-table td {
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--bg-secondary) 30%, transparent);
}

.reader-load-status {
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    text-align: center;
}

@media (max-width: 720px) {
    .file-reader-toolbar {
        align-items: stretch;
        flex-direction: column;
    }
}
