/* Web App page-specific styles — Editorial system (see assets/common.css). */

.app-main {
    flex: 1;
    padding: 34px 0 60px;
}

.app-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.app-left { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.app-right { position: sticky; top: 86px; min-width: 0; }

/* ===== Drop zone ===== */
.dropzone {
    background: var(--card);
    border: 1.5px dashed var(--border);
    border-radius: var(--rl);
    padding: 48px 28px;
    text-align: center;
    transition: all .2s var(--ease);
    position: relative;
    cursor: pointer;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.dropzone:hover {
    border-color: var(--text);
}
.dropzone.drag-over {
    border-color: var(--accent);
    border-style: solid;
    background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.dropzone.busy { cursor: default; }
.dropzone.busy .dz-inner { opacity: .35; pointer-events: none; }

.dz-icon {
    color: var(--blue);
    margin: 0 auto 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 16px;
    background: var(--seg);
}
.dz-title {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 6px;
}
.dz-sub {
    font-size: .92rem;
    color: var(--text2);
    margin-bottom: 14px;
}
.dz-formats {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--text3);
    letter-spacing: .02em;
}

/* Subtle note under dropzone — informs about 7-day retention. */
.web-storage-note {
    margin: 4px 4px 6px;
    font-family: var(--mono);
    font-size: .72rem;
    line-height: 1.6;
    color: var(--text3);
    text-align: center;
    letter-spacing: .01em;
}

.dz-progress {
    position: absolute;
    inset: 22px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    background: var(--card);
    border-radius: calc(var(--rl) - 8px);
    padding: 20px;
}
.dz-progress-label {
    display: flex;
    justify-content: space-between;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
}
#dz-progress-pct { color: var(--blue); font-variant-numeric: tabular-nums; font-family: var(--mono); }
.dz-progress-bar {
    height: 8px;
    background: var(--seg);
    border-radius: 4px;
    overflow: hidden;
}
.dz-progress-fill {
    height: 100%;
    width: 0;
    background: var(--blue);
    border-radius: 4px;
    transition: width .25s var(--ease);
}
.dz-progress-log {
    font-family: var(--mono);
    font-size: .74rem;
    color: var(--text2);
    text-align: center;
    min-height: 18px;
    transition: opacity .2s;
}

/* ===== Files list ===== */
.files-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--rl);
    padding: 20px;
}
.files-title {
    font-family: var(--mono);
    font-size: .74rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--text2);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.files-empty {
    text-align: center;
    color: var(--text3);
    font-family: var(--mono);
    font-size: .82rem;
    padding: 32px 12px;
}
.files-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.file-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--seg);
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: .15s;
}
.file-card:hover { border-color: var(--text3); }
.file-card.active { border-color: var(--text); background: var(--card); }
[data-theme="dark"] .file-card.active { background: var(--seg); }

.file-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--card);
    color: var(--blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--border);
}
.file-info { flex: 1; min-width: 0; }
.file-name {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.file-meta {
    display: flex;
    gap: 10px;
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--text2);
    margin-top: 3px;
    flex-wrap: wrap;
}
.file-status {
    font-family: var(--mono);
    font-size: .62rem;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 6px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.status-pending { background: var(--status-warning-surface); color: var(--orange); }
.status-uploading { background: var(--accent-soft); color: var(--accent); }
.status-completed { background: var(--status-success-surface); color: var(--green); }
.status-failed { background: var(--status-error-surface); color: var(--red); }

.spinner-mini {
    width: 10px; height: 10px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
    animation: spin .7s linear infinite;
    vertical-align: -1px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.files-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.files-pagination[hidden] { display: none; }
.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--mono);
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--text);
}
.page-btn.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}
.page-btn:disabled {
    opacity: .4;
    cursor: default;
}
.page-nav {
    font-size: 1.05rem;
    line-height: 1;
}
.page-ellipsis {
    color: var(--text3);
    padding: 0 4px;
    user-select: none;
    font-size: .9rem;
}

/* ===== Viewer ===== */
.viewer {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--rl);
    min-height: 480px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}
.viewer-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text3);
    font-family: var(--mono);
    font-size: .84rem;
    text-align: center;
}
.viewer-empty svg { opacity: .6; }

.viewer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.viewer-title {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.02em;
    word-break: break-word;
    margin: 0;
}
.viewer-meta {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--text2);
    margin-top: 5px;
    letter-spacing: .02em;
}
.viewer-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.viewer-action {
    padding: 8px 13px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 9px;
    font-size: .76rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: .15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.viewer-action:hover { border-color: var(--text); }
.viewer-action.danger { color: var(--red); }
.viewer-action.danger:hover { border-color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); }

.viewer-body {
    flex: 1;
    overflow-y: auto;
    font-size: .95rem;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 4px;
    max-height: 540px;
}
.viewer-segments .segment {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.viewer-segments .segment:last-child { border-bottom: none; }
.viewer-segments .seg-time {
    color: var(--blue);
    font-family: var(--mono);
    font-size: .7rem;
    font-weight: 600;
    display: block;
    margin-bottom: 3px;
}

.viewer-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text2);
    font-family: var(--mono);
    font-size: .82rem;
}
.spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

/* ===== Auth modal extras ===== */
.auth-tabs {
    display: flex;
    background: var(--seg);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 18px;
}
.auth-tab {
    flex: 1;
    padding: 9px 0;
    border-radius: 9px;
    font-size: .85rem;
    font-weight: 600;
    color: var(--text3);
    text-align: center;
    transition: .2s;
}
.auth-tab.active {
    background: var(--card);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
[data-theme="dark"] .auth-tab.active { box-shadow: 0 1px 4px rgba(0,0,0,.5); }

.email-form { margin-top: 12px; display: none; }
.email-form.show { display: block; }
.email-form-toggle {
    display: block;
    margin: 14px auto 0;
    font-size: .82rem;
    color: var(--blue);
    background: none;
    text-align: center;
    width: 100%;
    padding: 6px;
}
.email-form-toggle:hover { text-decoration: underline; }

.forgot-link {
    text-align: right;
    margin: -4px 0 12px;
}
.forgot-link button {
    font-size: .78rem;
    color: var(--blue);
    background: none;
    padding: 4px;
}
.forgot-link button:hover { text-decoration: underline; }

/* Mobile */
@media (max-width: 900px) {
    .app-grid { grid-template-columns: 1fr; }
    .app-right { position: static; }
    .viewer { min-height: 320px; }
}
@media (max-width: 768px) {
    .app-main { padding: 22px 0 40px; }
    .dropzone { padding: 36px 20px; min-height: 240px; }
    .dz-title { font-size: 1.3rem; }
    .dz-icon { width: 60px; height: 60px; }
    .dz-icon svg { width: 38px; height: 38px; }
}

/* ===== Usage-limit plaque (avatar menu) — mirrors iOS AccountCardView ===== */
.limit-plaque {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.limit-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.limit-title {
    font-family: var(--mono);
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text2);
}
.limit-value {
    display: flex;
    align-items: baseline;
}
.limit-pct {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.limit-max {
    font-size: .85rem;
    font-weight: 600;
    color: var(--text2);
}
.limit-bar {
    height: 8px;
    background: var(--seg);
    border-radius: 4px;
    overflow: hidden;
}
.limit-bar-fill {
    height: 100%;
    background: var(--blue);
    border-radius: 4px;
    transition: width .3s var(--ease);
}
.limit-reset {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--text3);
}

/* Tier badge — outline capsule (Base gray / Pro blue / Max orange / Max+ premium). */
.tier-badge {
    display: inline-block;
    font-family: var(--mono);
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid currentColor;
    line-height: 1.4;
}
.tier-base { color: var(--text2); }
.tier-pro { color: var(--blue); }
.tier-max { color: var(--orange); }
.tier-max_plus { color: var(--text); }

/* ===== Minutes → plan conversion widget — mirrors iOS MinutesConversionWidgetView ===== */
.conversion-widget {
    background: color-mix(in srgb, var(--orange) 9%, transparent);
    border: 1px solid color-mix(in srgb, var(--orange) 35%, transparent);
    border-radius: var(--rl);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
[data-theme="dark"] .conversion-widget {
    background: color-mix(in srgb, var(--orange) 13%, transparent);
}
.cw-head {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--orange);
}
.cw-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.cw-minutes {
    font-family: var(--mono);
    font-size: .82rem;
    font-weight: 700;
    color: var(--orange);
}
.cw-body {
    font-size: .88rem;
    line-height: 1.5;
    color: var(--text2);
    margin: 0;
}
.cw-plan {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--accent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.cw-term {
    font-family: var(--mono);
    font-size: .78rem;
    color: var(--text2);
}
.cw-cta {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: var(--orange-fill);
    color: #fff;
    font-size: .92rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s var(--ease), opacity .15s var(--ease);
}
.cw-cta:hover:not(:disabled) { filter: brightness(1.05); }
.cw-cta:disabled { opacity: .7; cursor: progress; }
