/* Producer v2 — status-first hierarchy matching the Fotonest Design System */

/* ─── Keyframes ─────────────────────────────────────────────────────────── */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.25)} }

/* ─── Page layout ───────────────────────────────────────────────────────── */
.p-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: 80px;
}

/* ─── Header additions ──────────────────────────────────────────────────── */
.c-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}
.c-header__left {
    display: flex;
    align-items: center;
}
/* Service name pill — right side of header */
.c-header__service-pill {
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 6px;
    padding: 4px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

/* ─── Shared eyebrow label ──────────────────────────────────────────────── */
.p-eyebrow {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}

/* ─── Status Hero ───────────────────────────────────────────────────────── */
.p-hero {
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    padding: 20px 22px;
    transition: background 0.35s ease, border-color 0.35s ease;
}
.p-hero[data-state="idle"] {
    background: linear-gradient(180deg, rgba(107,114,128,0.10), transparent 80%), rgba(255,255,255,0.02);
    border-color: rgba(107,114,128,0.25);
}
.p-hero[data-state="syncing"] {
    background: linear-gradient(180deg, rgba(59,130,246,0.10), transparent 80%), rgba(255,255,255,0.02);
    border-color: rgba(59,130,246,0.30);
}
.p-hero[data-state="ok"] {
    background: linear-gradient(180deg, rgba(52,211,153,0.08), transparent 80%), rgba(255,255,255,0.02);
    border-color: rgba(52,211,153,0.25);
}
.p-hero[data-state="error"] {
    background: linear-gradient(180deg, rgba(248,113,113,0.08), transparent 80%), rgba(255,255,255,0.02);
    border-color: rgba(248,113,113,0.30);
}

.p-hero__row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.p-hero__status-block {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}
.p-hero__status-line {
    display: flex;
    align-items: center;
    gap: 10px;
}
.p-hero__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.p-hero[data-state="idle"]    .p-hero__dot { background: #6B7280; box-shadow: 0 0 0 4px rgba(107,114,128,0.15); }
.p-hero[data-state="syncing"] .p-hero__dot { background: #3B82F6; box-shadow: 0 0 0 4px rgba(59,130,246,0.15), 0 0 12px #3B82F6; animation: pulse 1.4s ease-in-out infinite; }
.p-hero[data-state="ok"]      .p-hero__dot { background: #34D399; box-shadow: 0 0 0 4px rgba(52,211,153,0.15); }
.p-hero[data-state="error"]   .p-hero__dot { background: #F87171; box-shadow: 0 0 0 4px rgba(248,113,113,0.15); }

.p-hero__state-label {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #fff;
}
.p-hero__help {
    font-size: 12px;
    color: rgba(255,255,255,0.55);
}

/* ─── KPIs ──────────────────────────────────────────────────────────────── */
.p-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 28px;
    flex: 1;
    min-width: 320px;
}
.p-kpi {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.p-kpi__label {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}
.p-kpi__value {
    font-size: 22px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #fff;
    transition: color 0.2s ease;
}
.p-kpi__value--small { font-size: 14px; }

/* ─── Progress Strip ────────────────────────────────────────────────────── */
.p-progress {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.p-progress__meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    font-variant-numeric: tabular-nums;
}
.p-progress__text {
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
}
.p-progress__count {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}
.p-progress__track {
    width: 100%;
    height: 4px;
    border-radius: 99px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
}
.p-progress__fill {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, #3B82F6, #60A5FA);
    box-shadow: 0 0 12px rgba(59,130,246,0.5);
    transition: width 0.4s ease;
    width: 0%;
}

/* ─── Command Bar ───────────────────────────────────────────────────────── */
.p-cmd-bar {
    display: flex;
    align-items: stretch;
    gap: 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 12px 14px;
}
.p-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.p-field--flex2 { flex: 2; }
.p-field--action { flex: 0 0 auto; }
.p-field__label {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}
.p-divider {
    width: 1px;
    align-self: stretch;
    background: rgba(255,255,255,0.06);
}

/* Source dropdown re-skin inside command bar */
.p-cmd-bar .c-custom-select {
    position: relative;
    user-select: none;
    width: 100%;
}
.p-cmd-bar .c-custom-select[data-disabled="true"] {
    opacity: 0.4;
    pointer-events: none;
}
.p-cmd-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 36px;
    padding: 0 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
    width: 100%;
    font-family: inherit;
    text-align: left;
}
.p-cmd-trigger:hover {
    border-color: rgba(255,255,255,0.15);
}
.p-cmd-bar .c-custom-select.open .p-cmd-trigger {
    border-color: rgba(59,130,246,0.5);
    background: rgba(59,130,246,0.06);
}
.p-chevron {
    color: rgba(255,255,255,0.5);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.p-cmd-bar .c-custom-select.open .p-chevron {
    transform: rotate(180deg);
}
.p-cmd-bar .option-icon {
    display: inline-flex;
    width: 16px;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    flex-shrink: 0;
}
.p-cmd-bar .selected-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Dropdown menu */
.p-cmd-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: rgba(20,22,28,0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    box-shadow: 0 12px 40px -8px rgba(0,0,0,0.6);
    z-index: 200;
    overflow: hidden;
    padding: 4px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.15s ease;
}
.p-cmd-bar .c-custom-select.open .p-cmd-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.p-cmd-bar .c-custom-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    color: rgba(255,255,255,0.75);
    font-size: 13px;
    border-radius: 7px;
    cursor: pointer;
    border-bottom: none;
    transition: background 0.1s ease, color 0.1s ease;
}
.p-cmd-bar .c-custom-option:hover {
    background: rgba(59,130,246,0.10);
    color: #fff;
    padding-left: 10px;
}
.p-cmd-bar .c-custom-option.selected {
    background: rgba(59,130,246,0.08);
    color: #fff;
}

/* BETA badge */
.p-beta {
    font-size: 9px;
    letter-spacing: 0.08em;
    font-weight: 700;
    background: rgba(96,165,250,0.15);
    color: #93C5FD;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 2px;
}

/* Folder picker button */
.p-folder-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 36px;
    padding: 0 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    min-width: 0;
    width: 100%;
    font-family: inherit;
    overflow: hidden;
    transition: border-color 0.15s ease;
}
.p-folder-btn:hover { border-color: rgba(255,255,255,0.18); }
.p-folder-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.p-folder-btn svg { flex-shrink: 0; color: rgba(255,255,255,0.4); }
.p-folder-btn__label {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.p-folder-btn__label--set {
    color: #fff;
    font-family: ui-monospace, Menlo, 'Courier New', monospace;
    font-size: 12px;
}

/* Sync action button */
.p-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 18px;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(59,130,246,0.45);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    cursor: pointer;
    white-space: nowrap;
}
.p-action-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 6px rgba(59,130,246,0.45);
}
.p-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.p-action-btn--stop {
    background: rgba(248,113,113,0.12);
    border: 1px solid rgba(248,113,113,0.3);
    color: #FCA5A5;
    box-shadow: none;
}
.p-spinner {
    display: inline-block;
    width: 11px;
    height: 11px;
    border: 1.8px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
    flex-shrink: 0;
}

/* ─── Lower Grid ────────────────────────────────────────────────────────── */
.p-lower-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

/* ─── Section meta ──────────────────────────────────────────────────────── */
.p-section-title {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}
.p-section-sub {
    margin: 4px 0 0;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    max-width: 480px;
}

/* ─── File Queue ────────────────────────────────────────────────────────── */
.p-queue {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    overflow: hidden;
}
.p-queue__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 22px;
    flex-wrap: wrap;
}
.p-chips {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    flex-shrink: 0;
}
.p-chip {
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 500;
    background: transparent;
    color: rgba(255,255,255,0.5);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease, color 0.15s ease;
}
.p-chip--active {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.p-queue__table-wrap {
    border-top: 1px solid rgba(255,255,255,0.06);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.p-queue__table {
    width: 100%;
    border-collapse: collapse;
    color: inherit;
    font-family: inherit;
}
.p-th {
    text-align: left;
    padding: 10px 22px;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
    background: rgba(255,255,255,0.015);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap;
}
.p-th--right { text-align: right; }
.p-tr { border-bottom: 1px solid rgba(255,255,255,0.04); }
.p-tr:last-child { border-bottom: none; }
.p-td {
    padding: 12px 22px;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    vertical-align: middle;
}
.p-td--right { text-align: right; }
.p-td--file {
    padding: 12px 22px;
    font-size: 13px;
    vertical-align: middle;
}
.p-td--file-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}
.p-file-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.5);
    flex-shrink: 0;
}
.p-file-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.p-file-name {
    font-family: ui-monospace, Menlo, 'Courier New', monospace;
    font-size: 12px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}
.p-file-err {
    font-size: 11px;
    color: #FCA5A5;
    margin-top: 2px;
}
.p-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    color: rgba(255,255,255,0.92);
    white-space: nowrap;
}
.p-status-pill__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.p-retry-btn {
    padding: 5px 12px;
    border-radius: 7px;
    background: rgba(248,113,113,0.10);
    border: 1px solid rgba(248,113,113,0.25);
    color: #FCA5A5;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}
.p-retry-btn:hover {
    background: rgba(248,113,113,0.20);
}
.p-timestamp {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    font-variant-numeric: tabular-nums;
}
.p-queue__empty {
    padding: 40px 22px;
    font-size: 13px;
    color: rgba(255,255,255,0.3);
    text-align: center;
}

/* ─── Activity Timeline ─────────────────────────────────────────────────── */
.p-timeline {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 20px 22px;
}
.p-timeline__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
}
.p-timeline__sub {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.05em;
}
.p-timeline__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    max-height: 460px;
    overflow-y: auto;
}
.p-timeline__empty {
    font-size: 12px;
    color: rgba(255,255,255,0.35);
    padding: 16px 0 4px;
}
.p-timeline__item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.p-timeline__rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}
.p-timeline__dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    font-family: ui-monospace, Menlo, monospace;
    flex-shrink: 0;
    color: #0a0c10;
}
.p-timeline__line {
    flex: 1;
    width: 1px;
    background: rgba(255,255,255,0.07);
    margin-top: 3px;
    min-height: 10px;
}
.p-timeline__content {
    flex: 1;
    padding-bottom: 14px;
    min-width: 0;
}
.p-timeline__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}
.p-timeline__msg {
    font-size: 13px;
    color: #fff;
    font-weight: 500;
    letter-spacing: -0.005em;
}
.p-timeline__time {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}
.p-timeline__detail {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    display: block;
    margin-top: 3px;
    font-family: ui-monospace, Menlo, monospace;
    word-break: break-all;
}

/* ─── State banners (fatal / pending / quota) ───────────────────────────── */
.p-banner {
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    margin-top: 8px;
}
.p-banner--error {
    border-color: rgba(248,113,113,0.3);
    background: linear-gradient(180deg, rgba(248,113,113,0.06), transparent 80%), rgba(255,255,255,0.02);
}
.p-banner--pending {
    border-color: rgba(59,130,246,0.25);
    background: linear-gradient(180deg, rgba(59,130,246,0.06), transparent 80%), rgba(255,255,255,0.02);
}
.p-banner--quota {
    border-color: rgba(245,158,11,0.3);
    background: linear-gradient(180deg, rgba(245,158,11,0.06), transparent 80%), rgba(255,255,255,0.02);
}
.p-banner__title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #fff;
}
.p-banner--error .p-banner__title  { color: #F87171; }
.p-banner--quota .p-banner__title  { color: #FCD34D; }
.p-banner__body {
    font-size: 14px;
    color: rgba(255,255,255,0.55);
    line-height: 1.6;
}

/* ─── Mobile overrides ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .container { max-width: 600px !important; }

    .p-kpis {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
        min-width: 0 !important;
    }
    .p-hero__state-label { font-size: 18px; }
    .p-kpi__value { font-size: 18px; }

    .p-lower-grid {
        grid-template-columns: 1fr !important;
    }

    .p-cmd-bar {
        flex-wrap: wrap;
        gap: 10px;
    }
    .p-divider { display: none; }
    .p-field--flex2 { flex: 1 1 100%; }
    .p-field--action { flex: 1 1 100%; }
    .p-action-btn { width: 100%; justify-content: center; height: 44px; }
    .p-folder-btn { height: 44px; }
    .p-cmd-trigger { height: 44px; }
    .p-cmd-bar { padding: 12px; }
    .p-queue__head { flex-direction: column; align-items: flex-start; gap: 12px; }
}
