/* ===================================================
   Tasks AI Reorganize v2.0 — Overlay, Steps & Toggles
   =================================================== */

.air-overlay {
    position: fixed; inset: 0; z-index: 999999;
    background: rgba(0,0,0,.7);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    animation: airFadeIn .25s ease;
}
.air-overlay.air-closing { animation: airFadeOut .3s ease forwards; }

@keyframes airFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes airFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* -- Modal -- */
.air-modal {
    background: #0c0e1a;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 20px;
    width: 92vw; max-width: 640px;
    max-height: 85vh;
    display: flex; flex-direction: column;
    box-shadow: 0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.04);
    animation: airSlideUp .35s cubic-bezier(.21,1.02,.73,1);
    overflow: hidden;
}
@keyframes airSlideUp {
    from { transform: translateY(30px) scale(.97); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ===== STEP INDICATORS ===== */
.air-steps {
    display: flex; align-items: center; justify-content: center;
    padding: 18px 24px 14px; gap: 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.air-step {
    display: flex; align-items: center; gap: 6px;
    opacity: .35; transition: opacity .3s;
}
.air-step-active { opacity: 1; }
.air-step-done { opacity: .7; }
.air-step-num {
    width: 24px; height: 24px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: .7rem; font-weight: 700;
    background: rgba(255,255,255,.08); color: rgba(255,255,255,.5);
    transition: transform .3s ease-out, background .3s ease-out, border-color .3s ease-out, color .3s ease-out, opacity .3s ease-out;
}
.air-step-active .air-step-num {
    background: linear-gradient(135deg, #f5c842, #d4881a);
    color: #0c0e1a;
}
.air-step-done .air-step-num {
    background: rgba(100,255,140,.15); color: #6cff8c;
}
.air-step-label {
    font-size: .68rem; font-weight: 600; color: rgba(255,255,255,.5);
    text-transform: uppercase; letter-spacing: .05em;
}
.air-step-active .air-step-label { color: #f5c842; }
.air-step-done .air-step-label { color: rgba(100,255,140,.6); }
.air-step-line {
    width: 24px; height: 2px; margin: 0 6px;
    background: rgba(255,255,255,.08); border-radius: 1px;
    transition: background .3s;
}
.air-step-line-done { background: rgba(100,255,140,.3); }

/* ===== LOADING STATE ===== */
.air-loading {
    align-items: center; justify-content: center;
    padding: 40px 40px 50px; text-align: center;
    min-height: 340px;
}
.air-loading h2 {
    font-size: 1.15rem; font-weight: 600;
    color: rgba(255,255,255,.9); margin: 20px 0 6px;
}
.air-sub { font-size: .8rem; color: rgba(255,255,255,.35); margin: 0; }

.air-loader-wrap {
    position: relative; width: 64px; height: 64px;
}
.air-loader-orb {
    position: absolute; inset: 8px; border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #f5c842 0%, #d4881a 60%, #8b5800 100%);
    animation: airPulse 2s ease-in-out infinite;
}
.air-loader-ring {
    position: absolute; inset: 0; border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: #f5c842; border-right-color: rgba(245,200,66,.3);
    animation: airSpin 1.2s linear infinite;
}
@keyframes airPulse { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes airSpin { to { transform: rotate(360deg); } }

.air-loader-dots {
    display: flex; gap: 6px; justify-content: center; margin-top: 14px;
}
.air-loader-dots span {
    width: 6px; height: 6px; border-radius: 50%;
    background: #f5c842; opacity: .3;
    animation: airDot 1.2s ease-in-out infinite;
}
.air-loader-dots span:nth-child(2) { animation-delay: .2s; }
.air-loader-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes airDot { 0%,100% { opacity: .2; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.2); } }

/* -- Progress bar -- */
.air-progress-bar {
    width: 80%; max-width: 300px; height: 4px;
    background: rgba(255,255,255,.06); border-radius: 2px;
    margin: 18px auto 8px; overflow: hidden;
}
.air-progress-fill {
    height: 100%; width: 0%; border-radius: 2px;
    background: linear-gradient(90deg, #f5c842, #ff9f43);
    transition: width .5s ease;
}
.air-time-remaining {
    font-size: .72rem; color: rgba(255,255,255,.3);
    margin: 0; min-height: 1.2em;
}

/* ===== ERROR STATE ===== */
.air-error {
    align-items: center; justify-content: center;
    padding: 50px 40px; text-align: center;
}
.air-error h2 { color: #ff6b6b; font-size: 1.2rem; margin: 0 0 10px; }
.air-error p { color: rgba(255,255,255,.5); margin: 0 0 24px; }

/* ===== PLAN HEADER ===== */
.air-header {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 20px 28px 14px; border-bottom: 1px solid rgba(255,255,255,.06);
    position: relative;
}
.air-header-icon {
    flex-shrink: 0;
    width: 44px; height: 44px; border-radius: 12px;
    background: linear-gradient(135deg, #f5c842 0%, #d4881a 100%);
    display: flex; align-items: center; justify-content: center;
    color: #0c0e1a;
}
.air-header h2 {
    font-size: 1.1rem; font-weight: 700; color: #fff;
    margin: 0 0 4px; line-height: 1.2;
}
.air-summary {
    font-size: .82rem; color: rgba(255,255,255,.5);
    margin: 0; line-height: 1.4;
}
.air-close-x {
    position: absolute; top: 16px; right: 20px;
    background: none; border: none; color: rgba(255,255,255,.3);
    font-size: 1.5rem; cursor: pointer; line-height: 1;
    padding: 4px 8px; border-radius: 6px;
    transition: transform .15s ease-out, background .15s ease-out, border-color .15s ease-out, color .15s ease-out, opacity .15s ease-out;
}
.air-close-x:hover { color: #fff; background: rgba(255,255,255,.08); }

/* ===== STATS BAR ===== */
.air-stats {
    display: flex; gap: 0; padding: 0;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.air-stat {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; padding: 14px 12px;
    border-right: 1px solid rgba(255,255,255,.04);
}
.air-stat:last-child { border-right: none; }
.air-stat-num {
    font-size: 1.4rem; font-weight: 800;
    background: linear-gradient(135deg, #f5c842, #ff9f43);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.air-stat-label { font-size: .65rem; color: rgba(255,255,255,.35); text-transform: uppercase; letter-spacing: .08em; margin-top: 2px; }

/* ===== TOGGLE HINT ===== */
.air-toggle-hint {
    padding: 10px 24px;
    font-size: .72rem; color: rgba(245,200,66,.6);
    background: rgba(245,200,66,.04);
    border-bottom: 1px solid rgba(255,255,255,.04);
    text-align: center;
}

/* ===== SCROLLABLE BODY ===== */
.air-body {
    flex: 1; overflow-y: auto; padding: 16px 24px;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.1) transparent;
}

/* ===== SECTIONS ===== */
.air-section { margin-bottom: 20px; }
.air-section h3 {
    font-size: .78rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .1em; color: rgba(255,255,255,.4);
    margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
}
.air-section-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 22px; height: 22px; border-radius: 6px;
    background: rgba(245,200,66,.15); color: #f5c842;
    font-size: .75rem; font-weight: 700;
}
.air-icon-move { background: rgba(100,180,255,.15); color: #6cb4ff; }
.air-icon-prio { background: rgba(255,107,107,.15); color: #ff6b6b; }

/* ===== CARDS WITH TOGGLES ===== */
.air-card {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px; padding: 14px 16px;
    margin-bottom: 8px;
    display: flex; align-items: flex-start; gap: 12px;
    transition: transform .25s ease-out, background .25s ease-out, border-color .25s ease-out, color .25s ease-out, opacity .25s ease-out;
}
.air-card:hover { background: rgba(255,255,255,.05); }

/* Excluded card */
.air-card-excluded {
    opacity: .35;
    background: rgba(255,255,255,.01);
    border-color: rgba(255,255,255,.03);
}
.air-card-excluded:hover { opacity: .5; }

.air-card-body { flex: 1; min-width: 0; }
.air-card-body strong { color: #fff; font-size: .88rem; }
.air-card-body p, .air-reason {
    font-size: .75rem; color: rgba(255,255,255,.35);
    margin: 4px 0 0; line-height: 1.4;
}

.air-proj-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}

.air-task-title {
    font-size: .85rem; font-weight: 600; color: rgba(255,255,255,.85);
    margin-bottom: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* -- Toggle checkbox -- */
.air-toggle {
    flex-shrink: 0; display: flex; align-items: center;
    cursor: pointer; margin-top: 2px;
}
.air-toggle input { display: none; }
.air-toggle-check {
    width: 20px; height: 20px; border-radius: 6px;
    border: 2px solid rgba(255,255,255,.15);
    display: flex; align-items: center; justify-content: center;
    transition: transform .2s ease-out, background .2s ease-out, border-color .2s ease-out, color .2s ease-out, opacity .2s ease-out;
    position: relative;
}
.air-toggle-check::after {
    content: '';
    width: 10px; height: 10px; border-radius: 3px;
    background: #f5c842;
    transform: scale(0); transition: transform .2s;
}
.air-toggle input:checked + .air-toggle-check {
    border-color: #f5c842;
    background: rgba(245,200,66,.1);
}
.air-toggle input:checked + .air-toggle-check::after {
    transform: scale(1);
}

/* -- Move arrow -- */
.air-move-arrow {
    display: flex; align-items: center; gap: 8px;
    font-size: .78rem;
}
.air-from {
    color: rgba(255,255,255,.3);
    padding: 3px 8px; border-radius: 6px;
    background: rgba(255,100,100,.08); border: 1px solid rgba(255,100,100,.12);
}
.air-arrow { color: rgba(255,255,255,.2); font-size: .9rem; }
.air-to {
    color: #6cff8c;
    padding: 3px 8px; border-radius: 6px;
    background: rgba(100,255,140,.08); border: 1px solid rgba(100,255,140,.15);
    font-weight: 600;
}

/* -- Priority badges -- */
.air-prio-change {
    display: flex; align-items: center; gap: 8px;
}
.air-prio-badge {
    font-size: .72rem; font-weight: 700;
    padding: 3px 10px; border-radius: 20px;
    text-transform: uppercase; letter-spacing: .04em;
}
.air-prio-urgent { background: rgba(255,59,48,.2); color: #ff3b30; border: 1px solid rgba(255,59,48,.3); }
.air-prio-high   { background: rgba(255,149,0,.15); color: #ff9500; border: 1px solid rgba(255,149,0,.25); }
.air-prio-medium { background: rgba(100,180,255,.12); color: #6cb4ff; border: 1px solid rgba(100,180,255,.2); }
.air-prio-low    { background: rgba(100,255,140,.1); color: #6cff8c; border: 1px solid rgba(100,255,140,.15); }

/* -- Insights -- */
.air-insights {
    background: rgba(245,200,66,.04);
    border: 1px solid rgba(245,200,66,.1);
    border-radius: 12px; padding: 16px 18px;
}
.air-insights p {
    font-size: .82rem; color: rgba(255,255,255,.55);
    margin: 8px 0 0; line-height: 1.5;
}

/* ===== FOOTER ===== */
.air-footer {
    display: flex; justify-content: flex-end; align-items: center; gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid rgba(255,255,255,.06);
    background: rgba(0,0,0,.2);
}
.air-selected-count {
    font-size: .72rem; color: rgba(255,255,255,.3);
    margin-right: auto; margin-left: 4px;
}
.air-btn {
    border: none; border-radius: 10px;
    padding: 10px 22px; font-size: .82rem;
    font-weight: 600; cursor: pointer;
    transition: transform .2s ease-out, background .2s ease-out, border-color .2s ease-out, color .2s ease-out, opacity .2s ease-out;
}
.air-btn-close {
    background: rgba(255,255,255,.06); color: rgba(255,255,255,.5);
}
.air-btn-close:hover { background: rgba(255,255,255,.1); color: #fff; }
.air-btn-apply {
    background: linear-gradient(135deg, #f5c842 0%, #d4881a 100%);
    color: #0c0e1a; font-weight: 700;
}
.air-btn-apply:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(245,200,66,.3); }
.air-btn-apply:disabled {
    opacity: .5; cursor: not-allowed; transform: none; box-shadow: none;
}

/* ===== DIAGNOSTIC PANEL ===== */
.air-diagnostic {
    background: rgba(255,255,255,.03);
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 0 0 16px; text-align: left;
}
.air-diag-title {
    font-size: .65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em;
    color: rgba(255,255,255,.3); margin: 0 0 8px;
}
.air-diag-items {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.air-diag-item {
    font-size: .72rem; color: rgba(255,255,255,.5);
    padding: 4px 10px; border-radius: 8px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
}
.air-diag-item strong { color: rgba(255,255,255,.8); }
.air-diag-warn {
    background: rgba(255,149,0,.08);
    border-color: rgba(255,149,0,.15);
    color: rgba(255,149,0,.7);
}
.air-diag-warn strong { color: #ff9500; }

/* ===== PROJECT SELECTOR IN MOVES ===== */
.air-proj-select {
    background: rgba(100,255,140,.08);
    border: 1px solid rgba(100,255,140,.15);
    border-radius: 6px;
    color: #6cff8c; font-weight: 600;
    font-size: .78rem;
    padding: 3px 8px;
    cursor: pointer;
    max-width: 180px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236cff8c'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 20px;
}
.air-proj-select:focus {
    outline: none;
    border-color: #6cff8c;
    box-shadow: 0 0 0 2px rgba(100,255,140,.15);
}
.air-proj-select option {
    background: #1a1d2e;
    color: rgba(255,255,255,.8);
}

/* ===== TIME ESTIMATE (intro) ===== */
.air-time-estimate {
    display: flex; align-items: center; gap: 8px;
    justify-content: center;
    padding: 10px 18px; margin: 0 auto 16px;
    background: rgba(100,180,255,.06);
    border: 1px solid rgba(100,180,255,.1);
    border-radius: 10px;
    font-size: .78rem; color: rgba(255,255,255,.45);
    max-width: 280px;
}
.air-time-estimate strong { color: rgba(255,255,255,.7); }
.air-time-estimate svg { flex-shrink: 0; color: rgba(100,180,255,.5); }

/* ===== INTRO MODAL ===== */
.air-intro {
    padding: 0 36px 30px; text-align: center;
    max-width: 480px;
}
.air-intro-icon {
    width: 72px; height: 72px; border-radius: 20px;
    background: linear-gradient(135deg, rgba(245,200,66,.15), rgba(212,136,26,.1));
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 18px; color: #f5c842;
}
.air-intro h2 {
    font-size: 1.3rem; font-weight: 700; color: #fff; margin: 0 0 10px;
}
.air-intro-desc {
    font-size: .88rem; color: rgba(255,255,255,.55); margin: 0 0 20px; line-height: 1.5;
}
.air-intro-desc strong { color: rgba(255,255,255,.85); }
.air-intro-list {
    list-style: none; padding: 0; margin: 0 0 16px; text-align: left;
}
.air-intro-list li {
    display: flex; align-items: center; gap: 10px;
    font-size: .82rem; color: rgba(255,255,255,.6);
    padding: 8px 14px; border-radius: 10px;
    background: rgba(255,255,255,.03); margin-bottom: 6px;
    border: 1px solid rgba(255,255,255,.04);
}
.air-intro-bullet {
    flex-shrink: 0; width: 24px; height: 24px; border-radius: 7px;
    background: rgba(245,200,66,.12); color: #f5c842;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700;
}
.air-intro-note {
    font-size: .76rem; color: rgba(255,255,255,.3); margin: 0 0 24px;
    line-height: 1.5;
}
.air-intro-note strong { color: rgba(255,255,255,.5); }
.air-intro-actions {
    display: flex; justify-content: center; gap: 10px;
}

/* -- Trigger button (tooltip is now JS-based) -- */
.air-btn-trigger {
    position: relative;
}

/* ===== PREMIUM TOOLTIP ===== */
.air-tip {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    opacity: 0;
    transform: translate(-50%, calc(-100% + 6px));
    transition: opacity .25s ease, transform .25s cubic-bezier(.21,1.02,.73,1);
    width: 260px;
}
.air-tip-show {
    opacity: 1;
    transform: translate(-50%, -100%);
}
.air-tip-inner {
    background: linear-gradient(135deg, #1a1d2e 0%, #1e2235 100%);
    border: 1px solid rgba(245,200,66,.2);
    border-radius: 12px;
    padding: 14px 16px 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,.5), 0 0 20px rgba(245,200,66,.06);
}
.air-tip::after {
    content: '';
    position: absolute; bottom: -6px; left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(245,200,66,.2);
}
.air-tip-title {
    font-size: .82rem; font-weight: 700;
    color: #f5c842; margin: 0 0 6px;
}
.air-tip-text {
    font-size: .72rem; color: rgba(255,255,255,.55);
    line-height: 1.5; margin: 0 0 8px;
}
.air-tip-hint {
    font-size: .62rem; color: rgba(245,200,66,.4);
    text-transform: uppercase; letter-spacing: .08em;
    border-top: 1px solid rgba(255,255,255,.06);
    padding-top: 8px; margin: 0;
}

/* ===== MOBILE ===== */
@media (max-width: 640px) {
    .air-modal { width: 98vw; max-height: 92vh; border-radius: 16px; }
    .air-header { padding: 18px 16px 12px; }
    .air-body { padding: 12px 14px; }
    .air-footer { padding: 12px 14px; }
    .air-steps { padding: 12px 12px 10px; gap: 0; }
    .air-step-label { display: none; }
    .air-step-line { width: 16px; }
    .air-btn-trigger:hover::after,
    .air-btn-trigger:hover::before { display: none; }
}
