/* ---- Account hero: "Your account" + "Signed in as" (left), Sign out (right) ---- */
.account-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.account-hero-info {
    flex: 1 1 auto;
}

.account-hero-info h1 {
    margin: 0 0 4px;
}

.account-hero-info .account-signed-in {
    margin: 0;
    font-size: 0.95rem;
}

.account-hero-signout {
    flex: 0 0 auto;
    margin: 0 !important;
    max-width: none;
}

@media (max-width: 640px) {
    .account-hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .account-hero-signout {
        align-self: flex-start;
    }
}

/* ---- Header row: "Your orders" ---- */
.account-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 32px;
}

.account-header-row h2 {
    margin: 0;
    font-size: 1.5rem;
}

/* Backward compat for .account-signout-form — no longer used in templates. */
.account-signout-form {
    margin: 0;
    max-width: none;
}

/* ---- Support form (sign-in / support page) ---- */
.support-form {
    max-width: 640px;
    margin: 0 auto;
}

.support-form .field {
    margin-bottom: 18px;
}

.support-alert {
    padding: 10px 14px;
    margin-bottom: 18px;
    border-radius: 8px;
    border: 1px solid var(--color-accent, #4fc3f7);
    background: var(--color-surface, #12181f);
    color: var(--color-text, #e6edf3);
}

/* ---- Table wrapper (scrollable) ---- */
.account-orders-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-top: 16px;
}

.account-orders {
    width: 100%;
    /* Stage 5A-ACCOUNT-UI-POLISH: the table no longer stretches to the full
       1600px page width - capped so the 9 columns keep tight, even gaps
       instead of huge empty space between Download / License / Messages. */
    max-width: 1320px;
    margin: 0 auto;
    border-collapse: collapse;
    min-width: 1060px;
}

.account-orders th,
.account-orders td {
    padding: 16px 10px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 14px;
    vertical-align: middle;
}

.account-orders th {
    color: var(--color-muted, #8b98a5);
    font-weight: 500;
    white-space: nowrap;
    padding-top: 8px;
    padding-bottom: 8px;
}

.account-orders td {
    color: var(--color-text, #e6edf3);
}

/* ---- Stripe: very subtle alternating rows ---- */
.account-orders tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.015);
}

/* ---- Hover: subtle, only on pointer devices ---- */
@media (hover: hover) {
    .account-orders tbody tr:hover {
        background: rgba(255, 255, 255, 0.035);
    }
}

.account-orders a {
    color: var(--color-accent, #4fc3f7);
    text-decoration: none;
}

.account-orders a:hover {
    text-decoration: underline;
}

.account-orders-muted {
    color: var(--color-muted, #8b98a5);
}

.account-orders-empty {
    color: var(--color-muted, #8b98a5);
    margin-top: 16px;
}

/* ---- Column widths ---- */
.account-orders-th-col {
    width: 80px;
    min-width: 80px;
}

.account-orders-date-col {
    width: 180px;
    min-width: 150px;
}

.account-orders-video-col {
    width: 240px;
    min-width: 200px;
    max-width: 280px;
}

.account-orders-format-col,
.account-orders-price-col,
.account-orders-status-col {
    text-align: center;
}

.account-orders-format-col {
    width: 70px;
}

.account-orders-price-col {
    width: 80px;
}

.account-orders-status-col {
    width: 100px;
}

.account-orders-download-col {
    width: auto;
    min-width: 240px;
}

.account-orders-license-col {
    width: 90px;
    min-width: 80px;
    text-align: center;
}

.account-orders-msg-col {
    width: 100px;
    min-width: 80px;
    text-align: center;
}

/* ---- Preview / Thumb ---- */
.account-orders-thumb-cell {
    width: 80px;
    min-width: 80px;
    padding: 4px 8px;
}

.account-orders-thumb {
    display: block;
    width: 64px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.15s;
    border: 1px solid rgba(255, 255, 255, 0.10);
}

.account-orders-thumb:hover {
    opacity: 0.8;
}

.account-orders-thumb--empty {
    display: block;
    width: 64px;
    height: 48px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    cursor: default;
}

/* ---- Date cell: two lines ---- */
.account-orders-date-cell {
    white-space: nowrap;
    line-height: 1.6;
}

.account-orders-date-main {
    display: block;
    font-size: 14px;
    line-height: 1.4;
    color: var(--color-text, #e6edf3);
}

.account-orders-shortid {
    display: block;
    font-size: 11px;
    color: var(--color-muted, #8b98a5);
    font-family: ui-monospace, "SF Mono", monospace;
    line-height: 1.4;
    margin-top: 1px;
}

/* ---- Video cell ---- */
.account-orders-video-cell {
    max-width: 280px;
    min-width: 200px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.account-orders-video-link {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}

/* ---- Status badges for account table ---- */
/* Inherits .order-badge base from videos-grid.css; account-specific overrides */
.page-account .order-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.03em;
}

.page-account .order-badge--paid {
    background: var(--vg-accent, #2ecc71);
    color: #fff;
}

.page-account .order-badge--failed {
    background: rgba(255, 255, 255, 0.12);
    color: var(--color-muted, #8b98a5);
}

/* ---- Pay now button in table -- keep prominent but not aggressive ---- */
.account-orders .btn--pay {
    min-width: 90px;
}
/* ---- Status cell ---- */
.account-orders-status-cell {
    text-align: center;
    white-space: nowrap;
}

.account-orders-format-cell,
.account-orders-price-cell {
    text-align: center;
}

/* ---- Download cell ---- */
.account-orders-download-cell {
    white-space: nowrap;
    min-width: 240px;
}

.account-orders-dl-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-orders-dl-level1 {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.account-orders-dl-level2 {
    display: block;
    font-size: 12px;
    color: var(--color-muted, #8b98a5);
    line-height: 1.4;
    padding-left: 2px;
}

.account-orders-dl-count {
    font-size: 13px;
    white-space: nowrap;
    color: var(--color-muted, #8b98a5);
}

/* ---- License cell ---- */
.account-orders-license-cell {
    text-align: center;
    white-space: nowrap;
}

/* ---- Messages cell ---- */
.account-orders-msg-cell {
    text-align: center;
    white-space: nowrap;
}

/* ---- Collapsed orders ---- */
.account-orders-collapsed {
    margin-top: 0;
}

.account-orders-collapsed .account-orders {
    margin-top: 0;
}

.account-orders-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 13px;
    width: 100%;
    text-align: center;
    padding: 6px 12px;
    min-height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 6px;
    background: transparent;
    color: var(--color-muted, #8b98a5);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-weight: 500;
}

.account-orders-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--color-text, #e6edf3);
    border-color: rgba(255, 255, 255, 0.20);
}

@media (hover: none) {
    .account-orders-toggle:hover {
        background: transparent;
        color: var(--color-muted, #8b98a5);
        border-color: rgba(255, 255, 255, 0.10);
    }
}

/* If not expanded, show arrow pointing down */
.account-orders-toggle[aria-expanded="false"]::after {
    content: "\25BC";
    font-size: 9px;
    line-height: 1;
}

/* If expanded, show arrow pointing up */
.account-orders-toggle[aria-expanded="true"]::after {
    content: "\25B2";
    font-size: 9px;
    line-height: 1;
}

/* ---- Buttons inside table ---- */
.account-orders .btn--small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    min-height: 30px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    vertical-align: middle;
}

.account-orders .btn--small.btn--accent {
    background: #185a46;
    border: 1px solid #185a46;
    color: #fff;
}

.account-orders .btn--small.btn--accent:hover {
    background: #134a39;
    border-color: #134a39;
    color: #fff;
    text-decoration: none;
}

.account-orders .btn--small.btn--accent:disabled,
.account-orders .btn--small.btn--accent[disabled] {
    background: #507a69;
    border-color: #507a69;
    color: #fff;
}

/* Download disabled state */
.btn--disabled-limit {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--color-muted, #8b98a5);
    cursor: default;
    font-size: 12px;
    min-width: 130px;
}

/* License button */
.btn--license {
    min-width: 80px;
}

/* ---- Responsive ---- */
@media (max-width: 1200px) {
    .account-orders {
        min-width: 1060px;
    }
}

@media (max-width: 1024px) {
    .account-orders {
        min-width: 980px;
    }
    .account-orders th,
    .account-orders td {
        padding: 12px 8px;
    }
    .account-orders-video-col {
        max-width: 200px;
        min-width: 140px;
    }
    .account-orders-date-col {
        width: 150px;
    }
    .account-orders-download-col {
        min-width: 200px;
    }
    .account-orders-license-col {
        width: 80px;
        min-width: 70px;
    }
    .account-orders-msg-col {
        width: 90px;
        min-width: 70px;
    }
}

@media (max-width: 768px) {
    .account-orders {
        min-width: 900px;
    }
    .account-orders th,
    .account-orders td {
        padding: 10px 6px;
    }
    .account-orders-video-col {
        max-width: 160px;
        min-width: 110px;
    }
    .account-orders-date-col {
        width: 130px;
    }
    .account-header-row {
        flex-wrap: wrap;
    }
    .account-orders .btn--small {
        font-size: 12px;
        padding: 3px 8px;
        min-width: 90px;
    }
    .btn--license {
        min-width: 70px;
    }
    .account-orders-download-col {
        min-width: 180px;
    }
    .account-orders-license-col {
        width: 70px;
        min-width: 60px;
    }
    .account-orders-msg-col {
        width: 80px;
        min-width: 60px;
    }
}

@media (max-width: 640px) {
    .account-orders {
        min-width: 820px;
    }
    .account-orders th,
    .account-orders td {
        padding: 10px 5px;
        font-size: 12px;
    }
    .account-orders-thumb-cell,
    .account-orders-th-col {
        display: table-cell;
        width: 60px;
        min-width: 60px;
    }
    .account-orders-thumb,
    .account-orders-thumb--empty {
        width: 48px;
        height: 36px;
    }
    .account-orders-video-col {
        max-width: 140px;
        min-width: 90px;
    }
    .account-orders-date-col {
        width: 110px;
        min-width: 100px;
    }
    .account-orders-download-col {
        min-width: 160px;
    }
    .account-orders-license-col {
        width: 60px;
        min-width: 50px;
    }
    .account-orders-msg-col {
        width: 70px;
        min-width: 50px;
    }
    .account-hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .account-header-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Stage 5A-ACCOUNT-BUTTON-FIX: on the light emerald theme the base
   color #03222f on #2d8a6e gives only 3.90:1; override to #fff
   for all .btn--accent on the account page (Pay now, Download,
   Sign in, Sign out, Send message, Send login link). */
.page-account .btn--accent {
    color: #fff;
}

.page-account .btn--accent:hover {
    color: #fff;
}

.page-account .btn--accent:disabled,
.page-account .btn--accent[disabled] {
    background: #507a69;
    border-color: #507a69;
    color: #fff;
}

/* Stage 5A-ACCOUNT-BUTTON-FIX: download button on order detail page */
.page-account .btn--download.btn--accent {
    background: #185a46;
    border-color: #185a46;
    color: #fff;
}

.page-account .btn--download.btn--accent:hover {
    background: #134a39;
    border-color: #134a39;
    color: #fff;
}

/* Per-order message thread on /account/ (Stage 5A-3b).
   Theme variables with the site defaults as fallbacks only. */
.account-msg {
    margin-top: 12px;
}

.account-msg-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.account-msg-form select,
.account-msg-form textarea {
    background: var(--color-surface, #111);
    color: var(--color-text, #e6edf3);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
}

.account-msg-form textarea {
    min-height: 80px;
    resize: vertical;
}

.account-msg-quota {
    color: var(--color-muted, #9aa7b2);
    font-size: 13px;
}

.account-msg-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

.account-msg-item {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 0;
    font-size: 14px;
}

.account-msg-meta {
    color: var(--color-muted, #9aa7b2);
    font-size: 12px;
    margin-bottom: 4px;
}

.account-msg-badge {
    background: rgba(79, 195, 247, 0.15);
    color: var(--color-accent, #4fc3f7);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
    text-transform: uppercase;
}

.account-msg-limit {
    color: var(--color-muted, #9aa7b2);
    font-style: italic;
}

/* Standalone order-messages page (Stage 5A-ACCOUNT-UI-POLISH). */
.page-order-messages .page-content {
    max-width: 720px;
}

.order-summary {
    margin: 20px 0;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: var(--color-surface, #12181f);
}

.order-summary-video {
    margin: 0 0 8px;
    font-size: 16px;
}

.order-summary-video a {
    color: var(--color-accent, #4fc3f7);
    text-decoration: none;
}

.order-summary-video a:hover {
    text-decoration: underline;
}

.order-summary-dl {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin: 0;
    font-size: 13px;
}

.order-summary-dl dt {
    color: var(--color-muted, #8b98a5);
    min-width: 50px;
}

.order-summary-dl dd {
    margin: 0;
    color: var(--color-text, #e6edf3);
}

.support-alert--error {
    border-color: #ff6b6b;
    color: #ff8a8a;
}

.page-order-messages .account-msg-form {
    margin-top: 16px;
}

.page-order-messages .account-msg-list {
    margin: 0 0 8px;
}
