/* ===========================================================================
   MODALS — Premium redesign
   =========================================================================== */
.modal-backdrop {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    background-image: radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.4) 100%);
    backdrop-filter: blur(20px) saturate(0.85);
    -webkit-backdrop-filter: blur(20px) saturate(0.85);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.active {
    display: flex;
    animation: backdropIn 0.28s ease;
}

@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: linear-gradient(145deg, rgba(16,14,28,0.95) 0%, rgba(10,10,20,0.98) 100%);
    backdrop-filter: blur(30px) saturate(1.5);
    -webkit-backdrop-filter: blur(30px) saturate(1.5);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: var(--r-xl);
    width: 100%; max-width: 440px;
    max-height: 92vh; overflow-y: auto;
    box-shadow:
        0 32px 80px rgba(0,0,0,0.65),
        0 0 0 1px rgba(255,255,255,0.04) inset,
        0 0 80px rgba(124,110,248,0.07);
    animation: modalSpringIn 0.4s var(--ease-out-back);
    position: relative;
}

/* Top gradient accent on modals */
.modal::before {
    content: '';
    position: absolute;
    top: 0; left: 10%; right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(124,110,248,0.7), rgba(34,211,238,0.5), transparent);
    border-radius: 100%;
    pointer-events: none;
}

.modal-lg { max-width: 620px; }

@keyframes modalSpringIn {
    from { opacity: 0; transform: translateY(20px) scale(0.93); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 20px 22px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky; top: 0;
    background: linear-gradient(180deg, rgba(16,14,30,0.99) 0%, rgba(12,12,22,0.98) 100%);
    z-index: 10;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.3px;
}
.modal-title i { color: var(--accent); width: 18px; height: 18px; filter: drop-shadow(0 0 6px rgba(124,110,248,0.6)); }
.modal-sub   { font-size: 12px; color: var(--muted); margin-top: 4px; }

.close-btn {
    background: var(--elevated);
    border: 1px solid var(--border-md);
    color: var(--muted); cursor: pointer; padding: 6px;
    display: flex; align-items: center;
    border-radius: var(--r-sm);
    transition: color var(--t), background var(--t), border-color var(--t), transform 0.15s var(--ease-out-back);
    flex-shrink: 0;
}
.close-btn i { width: 15px; height: 15px; }
.close-btn:hover {
    color: var(--text);
    background: var(--elevated-2);
    border-color: var(--border-hi);
    transform: rotate(90deg) scale(1.1);
}

.modal-body {
    padding: 20px 22px;
    display: flex; flex-direction: column; gap: 15px;
}

.modal-foot {
    display: flex; gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
    border-radius: 0 0 var(--r-xl) var(--r-xl);
}

.cred-sec-lbl {
    font-size: 9px;
    font-weight: 800;
    color: var(--accent-text);
    text-transform: uppercase;
    letter-spacing: 1.4px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.85;
}
.cred-sec-lbl::before {
    content: '';
    width: 3px; height: 14px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 8px var(--accent-glow);
    flex-shrink: 0;
}

.pw-wrap { position: relative; display: flex; }
.pw-wrap input { padding-right: 42px; }

.pw-eye {
    position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--muted); cursor: pointer;
    display: flex; align-items: center; padding: 0;
    transition: color var(--t);
}
.pw-eye i { width: 14px; height: 14px; }
.pw-eye:hover { color: var(--accent-text); }

/* Modal Buttons */
.btn-primary {
    flex: 1;
    height: 42px; padding: 0 20px;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    color: #fff;
    border: none; border-radius: var(--r-sm);
    font-size: 13px; font-weight: 700;
    font-family: inherit; cursor: pointer;
    transition: opacity 0.18s, box-shadow 0.25s, transform 0.18s var(--ease-out-back);
    box-shadow: 0 2px 16px var(--accent-glow);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.2px;
}
/* Shine sweep */
.btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: -80%;
    width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-20deg);
    animation: btn-shine 4s ease-in-out infinite;
}
@keyframes btn-shine {
    0%   { left: -80%; }
    40%  { left: 140%; }
    100% { left: 140%; }
}
.btn-primary i { width: 14px; height: 14px; position: relative; z-index: 1; }
.btn-primary:hover {
    box-shadow: 0 6px 28px var(--accent-glow);
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0) scale(0.97);
    transition-duration: 0.08s;
}

.btn-ghost {
    height: 42px; padding: 0 18px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--elevated); color: var(--muted);
    border: 1px solid var(--border-md); border-radius: var(--r-sm);
    font-size: 13px; font-weight: 600;
    font-family: inherit; cursor: pointer;
    transition: color var(--t), border-color var(--t), background var(--t);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hi); background: var(--elevated-2); }

/* ===========================================================================
   WATCHLIST MODAL SPECIFICS
   =========================================================================== */
.wl-inventory-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wl-editor-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    height: 380px;
}

.wl-editor-panel {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}

.wl-panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--elevated);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wl-count {
    font-size: 11px;
    background: var(--accent-dim);
    color: var(--accent-text);
    border-radius: 20px;
    padding: 1px 8px;
    font-weight: 700;
    border: 1px solid rgba(124,110,248,0.2);
}

.wl-selected-list, .wl-available-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.wl-sel-item, .wl-avail-item {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    background: rgba(255,255,255,0.025);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
}
.wl-sel-item:hover, .wl-avail-item:hover {
    background: rgba(124,110,248,0.08);
    border-color: rgba(124,110,248,0.2);
    color: var(--text);
}
.wl-sel-item.dragging { opacity: 0.4; }
.wl-sel-item.drag-over { border-top: 2px solid var(--accent); }

.drag-handle { width: 14px; height: 14px; color: var(--dim); margin-right: 8px; cursor: grab; }
.wl-sel-name { flex: 1; }

.wl-rem-btn {
    background: none; border: none; color: var(--loss);
    cursor: pointer; padding: 3px; opacity: 0.5;
    transition: all 0.2s; border-radius: 4px;
}
.wl-rem-btn:hover { opacity: 1; background: var(--loss-dim); transform: scale(1.1); }
.wl-rem-btn i { width: 13px; height: 13px; }

/* Make Modal Inputs look glossy */
#wl_modal_name {
    width: 100%;
    padding: 11px 14px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-md);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}
#wl_modal_name:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-dim);
    outline: none;
}

/* Manage modal list */
.wl-inventory-list {
    padding: 4px 0;
}
.manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: border-color var(--t);
}
.manage-item:hover { border-color: var(--border-md); }
.manage-item-name { font-weight: 700; font-size: 14px; color: var(--text-2); }
.manage-item-actions { display: flex; gap: 6px; }
.manage-btn {
    background: transparent;
    border: 1px solid var(--border-md);
    color: var(--muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--r-sm);
    transition: all 0.2s;
    display: flex; align-items: center;
}
.manage-btn:hover { background: var(--elevated-2); color: var(--text); border-color: var(--border-hi); }
.manage-btn.danger:hover { color: var(--loss); border-color: rgba(240,80,78,0.3); background: var(--loss-dim); }
.manage-btn i { width: 16px; height: 16px; }
