/* ============================================================
   TranscribeFlow — Main Stylesheet
   Pastel / Subtle Colour Scheme
   ============================================================ */

:root {
    /* Primary palette — soft teal/sage */
    --primary: #5b9a8b;
    --primary-light: #8fc0b7;
    --primary-dark: #3d7a6b;
    --primary-bg: #eef6f4;

    /* Accent — warm lavender */
    --accent: #8b7ec8;
    --accent-light: #b5abe0;
    --accent-bg: #f3f0fa;

    /* Neutrals */
    --bg: #f8f9fb;
    --bg-card: #ffffff;
    --bg-sidebar: #f0f2f5;
    --border: #e2e5ea;
    --border-light: #eff1f4;
    --text: #2d3748;
    --text-light: #718096;
    --text-muted: #a0aec0;

    /* Status colours (soft) */
    --success: #68b984;
    --success-bg: #eef8f1;
    --warning: #e6a84d;
    --warning-bg: #fef8ee;
    --danger: #dc6b6b;
    --danger-bg: #fdf0f0;
    --info: #5da0d6;
    --info-bg: #eef5fb;

    /* Spacing */
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ---- Layout ---- */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 0 12px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary-bg);
    color: var(--primary);
    font-weight: 600;
}

.nav-link .icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.nav-link.active .icon { opacity: 1; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-muted);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-light);
}

.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 12px; color: var(--text-muted); }

/* Main content area */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    max-width: 1200px;
}

.page-header {
    margin-bottom: 28px;
}

.page-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.page-header .subtitle {
    font-size: 14px;
    color: var(--text-light);
}

/* ---- Cards ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-card .stat-change {
    font-size: 12px;
    margin-top: 6px;
}

.stat-card .stat-change.positive { color: var(--success); }
.stat-card .stat-change.negative { color: var(--danger); }

.stat-card.primary { border-left: 4px solid var(--primary); }
.stat-card.accent  { border-left: 4px solid var(--accent); }
.stat-card.success { border-left: 4px solid var(--success); }
.stat-card.warning { border-left: 4px solid var(--warning); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

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

.btn-accent     { background: var(--accent); color: white; }
.btn-accent:hover { background: #7a6db5; color: white; }

.btn-outline    { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); border-color: var(--text-muted); }

.btn-danger     { background: var(--danger); color: white; }
.btn-danger:hover { background: #c85a5a; color: white; }

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

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

/* ---- Forms ---- */
.form-group {
    margin-bottom: 20px;
}

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

.form-group .hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--bg-card);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(91, 154, 139, 0.15);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23718096' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control { resize: vertical; min-height: 100px; }

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

/* ---- Tables ---- */
.table-wrap {
    overflow-x: auto;
}

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

table th,
table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

table th {
    font-weight: 600;
    color: var(--text-light);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg);
}

table tr:hover td { background: var(--bg); }

table .actions {
    display: flex;
    gap: 8px;
}

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-primary { background: var(--primary-bg); color: var(--primary); }
.badge-accent  { background: var(--accent-bg); color: var(--accent); }
.badge-muted   { background: var(--bg); color: var(--text-muted); }

/* ---- Alerts ---- */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: var(--success-bg); color: #2d6a3f; border: 1px solid #c3e5ce; }
.alert-danger  { background: var(--danger-bg); color: #8b3a3a; border: 1px solid #f0c5c5; }
.alert-warning { background: var(--warning-bg); color: #7a5a1f; border: 1px solid #f0dbb8; }
.alert-info    { background: var(--info-bg); color: #2d5a7a; border: 1px solid #b8d4e8; }

/* ---- Upload Zone ---- */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    transition: var(--transition);
    cursor: pointer;
    background: var(--bg);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.upload-zone .icon {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.upload-zone h3 {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 4px;
}

.upload-zone p {
    font-size: 14px;
    color: var(--text-light);
}

/* Upload progress */
.upload-progress {
    margin-top: 16px;
}

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    justify-content: space-between;
}

/* ---- Balance Display ---- */
.balance-card {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}

.balance-card .balance-label {
    font-size: 13px;
    opacity: 0.85;
    margin-bottom: 4px;
}

.balance-card .balance-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
}

.balance-card .balance-unit {
    font-size: 16px;
    opacity: 0.85;
    font-weight: 400;
}

.balance-card .balance-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.balance-card .btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
}
.balance-card .btn:hover {
    background: rgba(255,255,255,0.3);
}

/* ---- Pricing Cards ---- */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.pricing-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    transition: var(--transition);
}

.pricing-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.pricing-card.featured {
    border-color: var(--primary);
    position: relative;
}

.pricing-card.featured::before {
    content: 'Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 2px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.pricing-card .plan-name { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.pricing-card .plan-price { font-size: 36px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.pricing-card .plan-price span { font-size: 14px; color: var(--text-muted); font-weight: 400; }
.pricing-card .plan-desc { font-size: 14px; color: var(--text-light); margin: 12px 0 20px; }

.pricing-card .plan-features {
    list-style: none;
    text-align: left;
    margin-bottom: 24px;
}

.pricing-card .plan-features li {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pricing-card .plan-features li::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
}

/* ---- Pagination ---- */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    transition: var(--transition);
}

.pagination a:hover { background: var(--primary-bg); border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Login / Auth Pages ---- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg) 0%, var(--primary-bg) 50%, var(--accent-bg) 100%);
    padding: 24px;
}

.auth-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 440px;
}

.auth-card .brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-card .brand .logo {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 22px;
    margin-bottom: 12px;
}

.auth-card .brand h1 {
    font-size: 22px;
    font-weight: 700;
}

.auth-card .brand p {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 4px;
}

.auth-card .form-group .form-control {
    padding: 12px 14px;
}

.auth-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    justify-content: center;
}

.auth-card .auth-links {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-light);
}

/* ---- Transcript Viewer ---- */
.transcript-viewer {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    color: var(--text);
}

.transcript-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0;
}
.transcript-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s, border-color 0.2s;
}
.transcript-tab:hover {
    color: var(--text);
}
.transcript-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.transcript-panel {
    display: none;
}
.transcript-panel.active {
    display: block;
}
.transcript-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 16px 0;
    font-size: 14px;
    color: var(--text-muted);
}
.transcript-meta dt {
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 2px;
}
.transcript-meta dd {
    margin: 0;
}
.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-light);
    transition: background 0.2s, color 0.2s;
}
.copy-btn:hover { background: var(--border); color: var(--text); }
.copy-btn.copied { background: var(--success-bg); color: var(--success); border-color: var(--success); }

/* ---- Responsive ---- */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    color: var(--text);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 20px 16px;
    }

    .mobile-menu-btn {
        display: block;
    }

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

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

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

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

    .auth-card {
        padding: 28px 20px;
    }
}

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-small  { font-size: 13px; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.hidden { display: none; }
