/* =============================================================
   UI SYSTEM — Ads-Manager Theme
   Gold primary · Steel-blue secondary · Near-black surfaces
   ============================================================= */

:root {
    /* Backgrounds */
    --ui-bg:        #08090E;
    --ui-surface:   #0F1219;
    --ui-surface-2: #0A0C12;

    /* Borders */
    --ui-border:    #1A2236;
    --ui-border-2:  #252D45;

    /* Text */
    --ui-text:      #E2E8F0;
    --ui-text-muted:#8896A8;

    /* Gold primary */
    --ui-primary:         #C9922A;
    --ui-primary-hover:   #B07C1E;
    --ui-primary-light:   #E8B86D;
    --ui-primary-tint:    rgba(201, 146, 42, 0.12);
    --ui-primary-ring:    rgba(201, 146, 42, 0.25);

    /* Steel-blue secondary */
    --ui-secondary:       #4A8FB8;
    --ui-secondary-hover: #3A7CA5;
    --ui-secondary-light: #7EC4E6;
    --ui-secondary-tint:  rgba(74, 143, 184, 0.12);

    /* Status */
    --ui-success:       #16a34a;
    --ui-success-hover: #15803d;
    --ui-danger:        #dc2626;
    --ui-danger-hover:  #b91c1c;
    --ui-warning:       #d97706;
}

/* ─── Page Shell ─────────────────────────────────────────── */

.ui-page-shell {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .ui-page-shell { gap: 1.5rem; }
}

/* ─── Cards ──────────────────────────────────────────────── */

.ui-card {
    background: linear-gradient(
        160deg,
        rgba(15, 18, 25, 0.97) 0%,
        rgba(8, 9, 14, 0.97) 100%
    );
    border: 1px solid var(--ui-border);
    border-top-color: rgba(201, 146, 42, 0.15);
    border-radius: 0.875rem;
    box-shadow:
        0 1px 0 rgba(201, 146, 42, 0.06) inset,
        0 16px 40px rgba(0, 0, 0, 0.55);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ui-card:hover {
    border-color: var(--ui-border-2);
    border-top-color: rgba(201, 146, 42, 0.30);
    box-shadow:
        0 1px 0 rgba(201, 146, 42, 0.10) inset,
        0 20px 48px rgba(0, 0, 0, 0.65);
}

.ui-card-muted {
    background: rgba(10, 12, 18, 0.70);
    border: 1px solid rgba(26, 34, 54, 0.80);
    border-radius: 0.75rem;
}

/* ─── Labels ─────────────────────────────────────────────── */

.ui-label {
    display: block;
    font-size: 0.70rem;
    text-transform: uppercase;
    letter-spacing: 0.10em;
    font-weight: 700;
    color: var(--ui-text-muted);
    margin-bottom: 0.5rem;
    font-family: ui-monospace, 'Cascadia Code', 'JetBrains Mono', monospace;
}

/* ─── Form Controls ──────────────────────────────────────── */

.ui-input,
.ui-select,
.ui-textarea {
    width: 100%;
    min-height: 44px;
    border-radius: 0.625rem;
    border: 1px solid var(--ui-border-2);
    background: #03040A;
    color: #F0F4FA;
    padding: 0.75rem 0.9rem;
    outline: none;
    font-size: 0.925rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ui-input::placeholder,
.ui-textarea::placeholder {
    color: #4A5568;
}

.ui-input:focus,
.ui-select:focus,
.ui-textarea:focus {
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 1px var(--ui-primary-ring);
}

/* ─── Buttons ────────────────────────────────────────────── */

.btn {
    min-height: 44px;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.625rem 1rem;
    transition:
        background-color 0.15s ease,
        transform 0.12s ease,
        border-color 0.15s ease,
        box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn:active { transform: translateY(1px); }

.btn:focus-visible {
    outline: 2px solid var(--ui-primary-light);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Gold — primary action */
.btn-primary {
    background: var(--ui-primary);
    color: #0A0A0A;
    font-weight: 700;
    border-color: var(--ui-primary-hover);
    box-shadow: 0 2px 8px rgba(201, 146, 42, 0.25);
}

.btn-primary:hover:not(:disabled) {
    background: var(--ui-primary-hover);
    box-shadow: 0 4px 14px rgba(201, 146, 42, 0.35);
}

/* Steel-blue — secondary action */
.btn-secondary {
    background: var(--ui-secondary);
    color: #fff;
    border-color: var(--ui-secondary-hover);
    box-shadow: 0 2px 8px rgba(74, 143, 184, 0.20);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--ui-secondary-hover);
}

/* Destructive */
.btn-destructive {
    background: var(--ui-danger);
    color: #fff;
    border-color: var(--ui-danger-hover);
}

.btn-destructive:hover:not(:disabled) {
    background: var(--ui-danger-hover);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--ui-text-muted);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    color: #F0F4FA;
    background: rgba(37, 45, 69, 0.50);
    border-color: var(--ui-border-2);
}

/* ─── Reusable App Toasts (compact/mobile-safe) ─────────── */

.ui-toast {
    border-radius: 0.65rem;
    border: 1px solid transparent;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.36);
    font-size: 0.80rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.01em;
    padding: 0.68rem 0.88rem;
    pointer-events: auto;
    transition: transform 0.2s ease, opacity 0.2s ease;
    will-change: transform, opacity;
}

.ui-toast-content {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
}

.ui-toast-right {
    width: min(92vw, 360px);
    margin-left: auto;
    opacity: 0;
    transform: translateX(20px);
}

.ui-toast-right.is-visible {
    opacity: 1;
    transform: translateX(0);
}

.ui-toast-center {
    width: min(92vw, 360px);
    text-align: center;
    display: flex;
    justify-content: center;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
}

.ui-toast-center.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ui-toast-success {
    background: #059669;
    border-color: #10b981;
    color: #ecfdf5;
}

.ui-toast-error {
    background: #dc2626;
    border-color: #ef4444;
    color: #fef2f2;
}

.ui-toast-warning,
.ui-toast-info {
    background: #0284c7;
    border-color: #38bdf8;
    color: #f0f9ff;
}

.ui-toast-queue {
    background: rgba(16,185,129,0.14);
    border-color: rgba(52,211,153,0.42);
    color: #6ee7b7;
    box-shadow: 0 0 14px rgba(52,211,153,0.12), 0 12px 28px rgba(0,0,0,0.34);
}

.ui-toast-danger {
    background: rgba(239,68,68,0.14);
    border-color: rgba(248,113,113,0.42);
    color: #fecaca;
    box-shadow: 0 0 14px rgba(239,68,68,0.12), 0 12px 28px rgba(0,0,0,0.34);
}

@media (max-width: 640px) {
    .ui-toast {
        font-size: 0.76rem;
        padding: 0.62rem 0.78rem;
    }
}

/* ─── Modal System ───────────────────────────────────────── */

.ui-modal-shell {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.ui-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 3, 8, 0.88);
    backdrop-filter: blur(3px);
}

.ui-modal-panel {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: min(92dvh, 92vh);
    overflow: hidden;
    border-radius: 1rem 1rem 0 0;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border-2);
    border-top-color: rgba(201, 146, 42, 0.25);
    box-shadow:
        0 -4px 32px rgba(0, 0, 0, 0.60),
        0 0 0 1px rgba(201, 146, 42, 0.08) inset;
    display: flex;
    flex-direction: column;
}

.ui-modal-header {
    padding: 1rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(26, 34, 54, 0.90);
}

.ui-modal-body {
    padding: 1rem;
    overflow-y: auto;
}

.ui-modal-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(26, 34, 54, 0.90);
    background: rgba(8, 9, 14, 0.80);
}

@media (min-width: 640px) {
    .ui-modal-shell {
        align-items: center;
        padding: 1rem;
    }

    .ui-modal-panel {
        max-width: 36rem;
        border-radius: 0.875rem;
        border-top-color: rgba(201, 146, 42, 0.25);
        box-shadow:
            0 24px 64px rgba(0, 0, 0, 0.70),
            0 0 0 1px rgba(201, 146, 42, 0.10) inset;
    }
}

@media (max-width: 640px) {
    .ui-modal-footer.sticky-mobile {
        position: sticky;
        bottom: 0;
    }
}

/* ─── Scrollbars ─────────────────────────────────────────── */

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(201, 146, 42, 0.30) rgba(10, 12, 18, 0.50);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(10, 12, 18, 0.50); }
::-webkit-scrollbar-thumb {
    background: rgba(201, 146, 42, 0.30);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(201, 146, 42, 0.55);
}
