/* path: public_html/imageworks/assets/imageworks.css */

:root {
    --bg: #080a12;
    --panel: #10121c;
    --surface: #171a28;
    --border: #2a2f45;
    --text: #e6e6e6;
    --muted: #aab0c0;
    --cyan: #00d4ff;
    --blue: #0057ff;
    --magenta: #ff008c;
    --purple: #8a2be2;
    --lime: #7cff00;
    --orange: #ff7a00;
    --danger: #ff008c;
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 8% 0%, rgba(0, 212, 255, .20), transparent 26rem),
        radial-gradient(circle at 98% 8%, rgba(138, 43, 226, .18), transparent 28rem),
        radial-gradient(circle at 50% 100%, rgba(124, 255, 0, .10), transparent 30rem),
        var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
    font: inherit;
}

.app-shell {
    width: min(100%, 1180px);
    margin: 0 auto;
    padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.hero-card,
.panel {
    background: rgba(16, 18, 28, .94);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .32);
}

.hero-card {
    padding: clamp(20px, 5vw, 38px);
    margin: 18px 0;
    overflow: hidden;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 58px;
    height: 58px;
    max-width: 58px;
    max-height: 58px;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
}

.eyebrow,
.section-label {
    margin: 0 0 5px;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}

h1,
h2 {
    margin: 0;
    letter-spacing: -.04em;
}

h1 {
    font-size: clamp(34px, 8vw, 72px);
    line-height: .92;
}

h2 {
    font-size: clamp(24px, 5vw, 38px);
}

.hero-copy {
    max-width: 720px;
    color: var(--muted);
    font-size: clamp(16px, 2.5vw, 20px);
    line-height: 1.65;
    margin: 22px 0;
}

.limit-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, 1fr);
}

.limit-grid div {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 14px;
    text-align: center;
}

.limit-grid strong {
    display: block;
    color: var(--lime);
    font-size: clamp(24px, 5vw, 36px);
    line-height: 1;
}

.limit-grid span {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.panel {
    padding: clamp(16px, 4vw, 26px);
    margin: 16px 0;
}

.panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.count-pill,
.status-badge {
    white-space: nowrap;
    color: var(--lime);
    background: rgba(124, 255, 0, .08);
    border: 1px solid rgba(124, 255, 0, .42);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 900;
}

.drop-zone {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 190px;
    padding: 24px;
    border: 1px dashed var(--cyan);
    border-radius: 24px;
    background: rgba(23, 26, 40, .82);
    cursor: pointer;
    text-align: center;
    transition: border-color .2s ease, transform .2s ease, background .2s ease;
}

.drop-zone.is-dragging {
    transform: translateY(-2px);
    border-color: var(--lime);
    background: rgba(124, 255, 0, .08);
}

.drop-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.drop-icon {
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    margin-bottom: 12px;
    color: var(--cyan);
    background: #080a12;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 36px;
    font-weight: 900;
}

.drop-zone strong {
    font-size: 18px;
}

.drop-zone small {
    margin-top: 8px;
    color: var(--muted);
}

.preview-grid,
.service-grid,
.download-list {
    display: grid;
    gap: 12px;
}

.preview-grid {
    margin-top: 16px;
    grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
}

.preview-card {
    position: relative;
    min-height: 126px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
}

.preview-card img {
    width: 100%;
    height: 94px;
    object-fit: cover;
    display: block;
}

.preview-card span,
.preview-card-info strong,
.preview-card-info small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-card-info {
    padding: 8px 10px;
}

.preview-card-info strong {
    color: var(--text);
    font-size: 12px;
}

.preview-card-info small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
}

.preview-card button {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    cursor: pointer;
    font-weight: 900;
}

.service-grid {
    grid-template-columns: repeat(2, 1fr);
}

.service-card {
    position: relative;
    min-height: 158px;
    cursor: pointer;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 14px 10px;
    text-align: center;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease;
}

.service-card:hover,
.service-card.is-selected {
    transform: translateY(-3px);
    border-color: var(--cyan);
    background: rgba(0, 212, 255, .07);
}

.service-card.is-selected {
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, .55);
}

.service-card.is-quota-empty {
    cursor: not-allowed;
    opacity: .48;
    transform: none;
    border-color: rgba(255, 0, 140, .42);
    background: rgba(255, 0, 140, .06);
}

.service-card.is-quota-empty:hover {
    transform: none;
    border-color: rgba(255, 0, 140, .42);
    background: rgba(255, 0, 140, .06);
}

.service-selected-dot {
    position: absolute;
    right: 11px;
    top: 8px;
    display: none;
    color: var(--lime);
    font-size: 12px;
}

.service-card.is-selected .service-selected-dot {
    display: inline;
}

.service-card img,
.service-fallback {
    width: 58px;
    height: 58px;
    max-width: 58px;
    max-height: 58px;
    margin: 0 auto 10px;
    object-fit: contain;
}

.service-fallback {
    display: none;
    place-items: center;
    color: var(--cyan);
    background: #080a12;
    border: 1px solid var(--border);
    border-radius: 16px;
    font-weight: 900;
}

.service-card strong,
.service-card small {
    display: block;
}

.service-card strong {
    font-size: 15px;
}

.service-card small {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.service-quota-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    margin: 8px auto 0;
    padding: 5px 9px;
    color: var(--lime);
    background: rgba(124, 255, 0, .08);
    border: 1px solid rgba(124, 255, 0, .38);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
}

.service-card.is-selected .service-quota-badge {
    color: #080a12;
    background: var(--lime);
    border-color: var(--lime);
}

.service-card.is-quota-empty .service-quota-badge {
    color: #fff;
    background: rgba(255, 0, 140, .18);
    border-color: rgba(255, 0, 140, .5);
}

.primary-button,
.secondary-button {
    width: 100%;
    border: 0;
    border-radius: 18px;
    padding: 16px 18px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 950;
}

.primary-button {
    color: #080a12;
    background: linear-gradient(135deg, var(--cyan), var(--lime));
}

.secondary-button {
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
}

.danger-button {
    margin-top: 12px;
    border-color: var(--danger);
    color: #fff;
    background: linear-gradient(135deg, var(--danger), var(--orange));
}

.primary-button:disabled,
.secondary-button:disabled {
    cursor: not-allowed;
    opacity: .58;
}

.helper-text,
.status-message,
.footer-note {
    color: var(--muted);
    line-height: 1.6;
}

.helper-text {
    margin: 12px 0 0;
    text-align: center;
    font-size: 13px;
}

.status-message {
    margin: 14px 0;
}

.progress-track {
    height: 12px;
    background: #080a12;
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--cyan), var(--lime));
    transition: width .3s ease;
}

.download-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.download-timer {
    margin: 14px 0;
    color: var(--lime);
    background: rgba(124, 255, 0, .08);
    border: 1px solid rgba(124, 255, 0, .35);
    border-radius: 16px;
    padding: 12px 14px;
    text-align: center;
    font-size: 14px;
    font-weight: 900;
}

.download-timer strong {
    color: var(--text);
}

.download-item,
.download-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
}

.download-link {
    color: var(--text);
    text-decoration: none;
}

.download-item span,
.download-link span {
    min-width: 0;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.download-item a,
.download-link strong {
    flex: 0 0 auto;
    color: #080a12;
    background: var(--lime);
    border-radius: 12px;
    padding: 10px 12px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
}

.download-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    border: 0;
    border-radius: 18px;
    padding: 16px 18px;
    cursor: pointer;
    color: #080a12;
    background: linear-gradient(135deg, var(--cyan), var(--lime));
    font-size: 16px;
    font-weight: 950;
    text-decoration: none;
}

.download-button span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.download-button strong {
    flex: 0 0 auto;
    color: #080a12;
    background: rgba(255, 255, 255, .48);
    border-radius: 12px;
    padding: 8px 11px;
    font-size: 13px;
}

.download-button:disabled {
    cursor: not-allowed;
    opacity: .62;
}

.download-button.is-downloaded {
    color: #fff;
    background: var(--blue);
}

.download-button.is-expired {
    color: #fff;
    background: var(--danger);
}

.manual-cleanup-button {
    width: auto;
    display: block;
    margin: 14px auto 0;
    padding: 10px 14px;
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 0, 140, .18);
    border: 1px solid rgba(255, 0, 140, .5);
    font-size: 12px;
    font-weight: 900;
}

.manual-cleanup-button:disabled {
    cursor: not-allowed;
    opacity: .45;
}

.footer-note {
    text-align: center;
    padding: 22px 0;
    font-size: 13px;
}

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

    .panel-head {
        align-items: stretch;
        flex-direction: column;
    }

    .count-pill,
    .status-badge {
        width: fit-content;
    }

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

@media (min-width: 680px) {
    .service-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 980px) {
    .app-shell {
        padding-inline: 24px;
    }

    .service-grid {
        grid-template-columns: repeat(7, 1fr);
    }
}

/* Auth layout: mobile-first and Tailwind-compliant utility-style structure */
.app-layout {
    display: grid;
    gap: 16px;
}

.main-column {
    min-width: 0;
}

.auth-panel {
    order: -1;
}

.auth-card {
    position: sticky;
    top: 16px;
    background:
        linear-gradient(145deg, rgba(0, 212, 255, .10), transparent 38%),
        rgba(16, 18, 28, .96);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 28px 80px rgba(0, 0, 0, .32);
    padding: clamp(16px, 4vw, 24px);
}

.auth-head p,
.auth-modal-copy {
    color: var(--muted);
    line-height: 1.6;
}

.register-limit-button {
    width: 100%;
    display: grid;
    gap: 4px;
    margin: 0 0 18px;
    padding: 16px 18px;
    border: 1px solid rgba(0, 212, 255, .5);
    border-radius: 22px;
    cursor: pointer;
    text-align: left;
    color: #080a12;
    background:
        radial-gradient(circle at 95% 10%, rgba(255, 255, 255, .48), transparent 6rem),
        linear-gradient(135deg, var(--cyan), var(--lime));
    box-shadow: 0 16px 42px rgba(0, 212, 255, .22);
    transition: transform .18s ease, box-shadow .18s ease;
}

.register-limit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 52px rgba(124, 255, 0, .20);
}

.register-limit-button span,
.register-limit-button strong {
    display: block;
}

.register-limit-button span {
    font-size: 15px;
    font-weight: 950;
}

.register-limit-button strong {
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.auth-login-form,
.auth-step {
    display: grid;
    gap: 12px;
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-field > span:first-child,
.remember-row {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.auth-field input {
    width: 100%;
    min-height: 48px;
    color: var(--text);
    background: #080a12;
    border: 1px solid var(--border);
    border-radius: 16px;
    outline: none;
    padding: 13px 14px;
}

.auth-field input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 4px rgba(0, 212, 255, .10);
}

.password-wrap {
    position: relative;
    display: block;
}

.password-wrap input {
    padding-right: 48px;
}

.eye-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    width: 36px;
    height: 36px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    color: var(--text);
    background: rgba(255, 255, 255, .08);
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 9px;
    text-transform: none;
    letter-spacing: 0;
}

.remember-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--lime);
}

.auth-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.auth-links button {
    border: 0;
    padding: 0;
    cursor: pointer;
    color: var(--cyan);
    background: transparent;
    font-size: 13px;
    font-weight: 900;
}

.auth-user-box {
    display: grid;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 14px;
}

.auth-user-box span,
.auth-user-box small {
    color: var(--muted);
    font-size: 12px;
}

.auth-user-box strong {
    overflow: hidden;
    color: var(--lime);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-logout-button {
    margin-top: 8px;
    padding-block: 12px;
}

.auth-message {
    min-height: 22px;
    margin: 12px 0 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 13px;
}

.auth-message.is-success {
    color: var(--lime);
}

.auth-message.is-error {
    color: var(--danger);
}

.auth-message.is-working {
    color: var(--cyan);
}

.primary-button.is-loading,
.secondary-button.is-loading {
    position: relative;
    opacity: .78;
}

.primary-button.is-loading::after,
.secondary-button.is-loading::after {
    content: "";
    display: inline-block;
    width: .9em;
    height: .9em;
    margin-left: 10px;
    vertical-align: -0.12em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 999px;
    animation: iw-spin .75s linear infinite;
}

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

.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: end center;
    padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
}

.auth-modal[hidden] {
    display: none;
}

.auth-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(10px);
}

.auth-modal-card {
    position: relative;
    width: min(100%, 520px);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background:
        radial-gradient(circle at 12% 0%, rgba(0, 212, 255, .18), transparent 16rem),
        rgba(16, 18, 28, .98);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 35px 110px rgba(0, 0, 0, .55);
    padding: clamp(18px, 5vw, 28px);
}

.auth-modal-close {
    position: absolute;
    right: 14px;
    top: 14px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    color: #fff;
    background: rgba(255, 0, 140, .28);
    font-size: 24px;
    line-height: 1;
}

.password-rules {
    display: grid;
    gap: 8px;
    margin: 4px 0;
    padding: 12px;
    background: rgba(8, 10, 18, .75);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.password-rules p {
    position: relative;
    margin: 0;
    padding-left: 22px;
    color: var(--danger);
    font-size: 13px;
    font-weight: 800;
}

.password-rules p::before {
    position: absolute;
    left: 0;
    content: "✕";
}

.password-rules p.is-valid {
    color: var(--lime);
}

.password-rules p.is-valid::before {
    content: "✓";
}

@media (min-width: 980px) {
    .app-shell {
        width: min(100%, 1320px);
    }

    .app-layout {
        grid-template-columns: minmax(0, 1fr) 360px;
        align-items: start;
        gap: 20px;
    }

    .auth-panel {
        order: 0;
        margin-top: 18px;
    }
}

@media (min-width: 1180px) {
    .app-layout {
        grid-template-columns: minmax(0, 1fr) 390px;
        gap: 24px;
    }
}

@media (max-width: 420px) {
    .auth-card,
    .auth-modal-card {
        border-radius: 22px;
    }

    .auth-links {
        align-items: flex-start;
        flex-direction: column;
    }

    .register-limit-button {
        border-radius: 18px;
    }
}
