/* Lab Transcribe - ElevenLabs-inspired UI */

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

:root {
    --bg-main: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-hover: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;
    --accent-primary: #000000;
    --accent-hover: #1f2937;
    --sidebar-width: 240px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-secondary);
    font-size: 14px;
}

/* Layout with sidebar */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-main);
    border-right: 1px solid var(--border-light);
    padding: 1.5rem 1rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 0 0.75rem;
    color: var(--text-primary);
    flex-wrap: wrap;
}

.brand-lockup {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    flex-shrink: 0;
}

.brand-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.brand-name {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.brand-app {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-size: 14px;
}

.sidebar-nav a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-weight: 500;
}

.sidebar-nav a svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
    max-width: 1400px;
}

/* Header section */
.page-header {
    margin-bottom: 2rem;
}

.page-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Primary button (CTA) */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--accent-primary);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

/* Search bar */
.search-container {
    margin-bottom: 1.5rem;
}

.search-input {
    width: 100%;
    max-width: 500px;
    padding: 0.625rem 1rem 0.625rem 2.5rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-main);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    background-size: 18px;
    transition: border-color 0.15s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--border-medium);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* Jobs table */
.jobs-table-container {
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    overflow: visible;
}

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

.jobs-table thead {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.jobs-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 500;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.jobs-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s ease;
}

.jobs-table tbody tr:last-child {
    border-bottom: none;
}

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

.jobs-table td {
    padding: 1rem;
    vertical-align: middle;
}

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

.job-title {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.job-filename {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.job-date {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Kebab menu (3 dots) */
.kebab-menu-container {
    position: relative;
}

.kebab-btn {
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.kebab-btn svg {
    width: 20px;
    height: 20px;
}

.kebab-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1000;
    padding: 0.5rem 0;
}

.kebab-dropdown.show {
    display: block;
}

.kebab-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    transition: background 0.15s ease;
}

.kebab-dropdown-item:hover {
    background: var(--bg-hover);
}

.kebab-dropdown-item.danger {
    color: #dc2626;
}

.kebab-dropdown-item.has-submenu::after {
    content: '›';
    font-size: 18px;
    color: var(--text-muted);
}

/* Submenu */
.kebab-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    z-index: 1001;
    padding: 0.5rem 0;
    margin-left: 4px;
}

.kebab-submenu.show {
    display: block;
}

.kebab-submenu.open-left {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 4px;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-icon {
    font-size: 12px;
    line-height: 1;
}

.status-queued {
    background: #fef3c7;
    color: #92400e;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-done {
    background: #d1fae5;
    color: #065f46;
}

.status-error {
    background: #fee2e2;
    color: #991b1b;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Modal/Dialog */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: var(--bg-main);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 14px;
}

.modal-input:focus {
    outline: none;
    border-color: var(--border-medium);
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-secondary {
    padding: 0.625rem 1.25rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
}

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

.btn-danger {
    padding: 0.625rem 1.25rem;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s ease;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Upload page specific */
.upload-card {
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 2rem;
}

.upload-progress {
    margin: 1.5rem 0 0.5rem;
    padding: 1rem;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.upload-progress[hidden] {
    display: none;
}

.upload-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-progress-percent {
    color: var(--text-secondary);
    font-weight: 600;
}

.upload-progress-bar {
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    width: 0%;
    transition: width 0.2s ease;
}

.upload-progress-status {
    margin-top: 0.75rem;
    font-size: 13px;
    color: var(--text-secondary);
}

.upload-progress.error {
    border-color: #fecaca;
    background: #fef2f2;
}

.upload-progress.error .upload-progress-status,
.upload-progress.error .upload-progress-percent {
    color: #b91c1c;
}

.selected-files {
    margin-top: 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.selected-files-header,
.selected-files-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 1rem;
    padding: 0.65rem 0.85rem;
    align-items: start;
}

.selected-files.single-column .selected-files-header,
.selected-files.single-column .selected-files-row {
    grid-template-columns: minmax(0, 1fr);
}

.selected-files-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-main);
}

.selected-files-row + .selected-files-row {
    border-top: 1px solid var(--border-light);
}

.selected-file-name,
.selected-job-name {
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}

/* Cloud Storage Providers */
.cloud-providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.cloud-provider-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cloud-provider-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cloud-provider-details {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex: 1;
}

.cloud-provider-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

.cloud-provider-actions .btn-primary,
.cloud-provider-actions .btn-secondary {
    white-space: nowrap;
}

.cloud-provider-disconnect {
    padding: 0.4rem 0.9rem;
    font-size: 12px;
    line-height: 1.2;
}

.cloud-provider-disconnect:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cloud-provider-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cloud-provider-card:active {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.cloud-provider-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--text-primary);
}

.cloud-provider-info {
    flex: 1;
    min-width: 0;
}

.cloud-provider-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.cloud-provider-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cloud-provider-path {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cloud-provider-folder-panel {
    border-top: 1px solid var(--border-light);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cloud-provider-folder-hint {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.cloud-provider-current-path {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    flex-wrap: wrap;
}

.cloud-provider-current-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.cloud-provider-current-value {
    font-family: monospace;
    font-size: 14px;
    font-weight: 600;
    word-break: break-all;
}

.cloud-provider-folder-browser {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cloud-provider-folder-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.cloud-provider-folder-title span {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 12px;
}

.cloud-provider-folder-list {
    min-height: 160px;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: #fff;
}

.cloud-provider-folder-empty,
.cloud-provider-folder-error {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.cloud-provider-folder-error {
    color: var(--error);
}

.folder-item {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background-color 0.15s ease;
}

.folder-item:last-child {
    border-bottom: none;
}

.folder-item-parent {
    background: #f8f9fa;
    gap: 0.5rem;
}

.cloud-provider-watched-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.cloud-provider-watched-items {
    max-height: 180px;
    overflow-y: auto;
}

.cloud-provider-watched-card {
    padding: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 14px;
}

.cloud-provider-watched-path,
.cloud-provider-watched-meta {
    color: var(--text-muted);
    font-size: 12px;
}

.cloud-provider-watched-empty {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

.status-connected {
    background: #d1fae5;
    color: #065f46;
}

.status-disconnected {
    background: #f3f4f6;
    color: #6b7280;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary);
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    font-size: 14px;
    background: var(--bg-main);
    transition: border-color 0.15s ease;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--border-medium);
}

.form-help {
    display: block;
    margin-top: 0.5rem;
    font-size: 12px;
    color: var(--text-muted);
}

.form-required {
    color: #dc2626;
}

/* Footer */
.app-footer {
    margin-top: 3rem;
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    /* Convert sidebar to header */
    .sidebar {
        width: 100% !important;
        height: auto;
        position: sticky;
        top: 0;
        z-index: 100;
        border-right: none;
        border-bottom: 1px solid var(--border-light);
        padding: 0.875rem 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
    }

    .sidebar-logo {
        margin-bottom: 0;
        padding: 0;
        gap: 0.5rem;
        flex-wrap: nowrap;
        flex-shrink: 1;
    }

    .brand-icon {
        width: 32px;
        height: 32px;
        border-radius: 8px;
    }

    .brand-icon svg {
        width: 20px;
        height: 20px;
    }

    .brand-name {
        font-size: 11px;
    }

    .brand-app {
        font-size: 16px;
    }

    .sidebar-nav {
        flex-direction: row;
        flex: 0;
        gap: 0.25rem;
        overflow-x: visible;
    }

    .sidebar-nav a {
        padding: 0.5rem 0.75rem;
        font-size: 13px;
        gap: 0.5rem;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .sidebar-nav a svg {
        width: 18px;
        height: 18px;
    }

    .sidebar-nav a {
        padding: 0.4rem 0.5rem;
        font-size: 13px;
        white-space: nowrap;
    }

    .sidebar-nav a svg {
        width: 18px;
        height: 18px;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem 1rem;
    }

    .page-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .btn-primary {
        width: 100%;
        justify-content: center;
    }

    .search-input {
        max-width: none;
    }

    /* Convert table to card layout on mobile */
    .jobs-table {
        display: block;
        min-width: 0;
    }

    .jobs-table thead {
        display: none;
    }

    .jobs-table tbody {
        display: block;
    }

    .jobs-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border-light);
        border-radius: 8px;
    }

    .jobs-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .jobs-table td {
        display: block;
        padding: 1rem;
        border: none;
    }

    .jobs-table td:first-child {
        padding-bottom: 0.5rem;
    }

    .jobs-table td:last-child {
        padding-top: 0.5rem;
    }

    /* Adjust date and kebab menu layout for mobile */
    .jobs-table td[style*="text-align: right"] {
        text-align: left !important;
    }

    .jobs-table td[style*="text-align: right"] > div {
        justify-content: space-between !important;
    }

    .job-date {
        font-size: 13px;
    }

    /* Cloud providers on mobile */
    .cloud-providers-grid {
        grid-template-columns: 1fr;
    }

    .cloud-provider-card {
        padding: 1rem;
    }

    .cloud-provider-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .cloud-provider-actions {
        width: 100%;
        align-items: stretch;
    }

    .cloud-provider-actions .btn-primary,
    .cloud-provider-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }

    .cloud-provider-icon {
        width: 40px;
        height: 40px;
    }

    .cloud-provider-icon svg {
        width: 24px;
        height: 24px;
    }

    .cloud-provider-name {
        font-size: 14px;
    }
}


/* Extra small screens - icon-only navigation */
@media (max-width: 480px) {
    .sidebar {
        padding: 0.75rem 0.875rem;
    }

    .sidebar-logo {
        gap: 0.4rem;
    }

    .brand-app {
        font-size: 15px;
    }

    .sidebar-nav a {
        padding: 0.5rem;
        gap: 0;
        min-width: 36px;
        justify-content: center;
    }

    /* Hide text labels on very small screens, show icons only */
    .sidebar-nav a svg {
        margin: 0;
    }

    .sidebar-nav a {
        font-size: 0;
    }

    .sidebar-nav a svg {
        font-size: 14px;
    }

    /* Folder modal adjustments for very small screens */
    .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .folder-item {
        font-size: 14px;
    }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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