/* ═══════════════════════════════════════════════════════
   QUICKTOOLS — SHARED TOOL COMPONENTS
   /assets/css/tools-shared.css
   Load on every tool page via <link>
   ═══════════════════════════════════════════════════════ */

/* ─── Input Row: input + add button ─── */
.qt-input-row {
    display: flex;
    gap: var(--space-2);
    align-items: stretch;
}
.qt-input-row .input { flex: 1; min-width: 0; }
.qt-input-row__add {
    width: 48px; min-width: 48px; height: 48px;
    font-size: 22px; font-weight: 700;
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    padding: 0; background: var(--accent); color: #fff;
    border: none; cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast);
}
.qt-input-row__add:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

/* ─── Bulk add ─── */
.qt-bulk { margin-top: var(--space-2); }
.qt-bulk summary {
    cursor: pointer; color: var(--accent);
    font-size: var(--font-size-sm); font-weight: 500;
    user-select: none; padding: var(--space-1) 0;
}
.qt-bulk summary:hover { text-decoration: underline; }
.qt-bulk .textarea { margin-top: var(--space-2); font-size: var(--font-size-sm); }
.qt-bulk .btn { margin-top: var(--space-2); }

/* ─── Chips ─── */
.qt-chips {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: var(--space-3); min-height: 20px;
}
.qt-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px;
    background: var(--accent-bg); border: 1px solid var(--accent-light);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm); font-weight: 500; color: var(--accent-text);
    animation: qtChipIn 0.2s ease;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.qt-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
@keyframes qtChipIn {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}
.qt-chip__name {
    max-width: 120px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.qt-chip__remove {
    display: flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    border: none; background: rgba(139,92,246,0.15);
    color: var(--accent); font-size: 14px; font-weight: 700;
    cursor: pointer; line-height: 1; padding: 0;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.qt-chip__remove:hover { background: var(--error); color: #fff; }
.qt-chip--eliminated {
    background: var(--bg-tertiary); border-color: var(--border);
    color: var(--text-tertiary); opacity: 0.5; text-decoration: line-through;
}
.qt-item-count {
    margin-top: var(--space-2);
    font-size: var(--font-size-xs);
    color: var(--text-tertiary); font-weight: 500;
}

/* ─── Params Box ─── */
.qt-params {
    display: grid; gap: var(--space-3);
    margin-top: var(--space-4); padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}
.qt-params--cols-2 { grid-template-columns: repeat(2, 1fr); }
.qt-params--cols-3 { grid-template-columns: repeat(3, 1fr); }
.qt-params label {
    font-size: var(--font-size-xs); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-1); display: block;
}
.qt-params .select, .qt-params .input {
    width: 100%; font-size: var(--font-size-sm);
}
@media (max-width: 640px) {
    .qt-params--cols-2, .qt-params--cols-3 {
        grid-template-columns: 1fr;
        gap: var(--space-2); padding: var(--space-3);
    }
}

/* ─── Main Action Button ─── */
.qt-main-btn {
    margin-top: var(--space-5);
    width: 100%; max-width: 360px;
    font-size: var(--font-size-lg); padding: 14px 24px;
    border-radius: var(--radius-xl); font-weight: 700;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.qt-main-btn:not(:disabled):hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-accent);
}
.qt-main-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Result Section ─── */
.tool-result { position: relative; overflow: hidden; }
.tool-result--animate { animation: qtSlideIn 0.5s ease; }
@keyframes qtSlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Result badge */
.qt-result-badge {
    text-align: center;
    font-size: var(--font-size-xl); font-weight: 800;
    color: var(--accent); margin-bottom: var(--space-4);
    display: flex; align-items: center; justify-content: center;
    gap: var(--space-2);
}
.qt-result-badge::before,
.qt-result-badge::after {
    content: '✦'; font-size: 14px; color: #F59E0B;
}

/* Result meta */
.qt-result-meta {
    text-align: center; font-size: var(--font-size-sm);
    color: var(--text-tertiary); margin-bottom: var(--space-4);
}

/* Action buttons row */
.tool-result__actions {
    display: flex; gap: var(--space-2);
    justify-content: center; flex-wrap: wrap;
}
.tool-result__actions .btn {
    min-height: 44px; padding: 10px 20px;
    font-size: var(--font-size-sm); border-radius: var(--radius-lg);
}

/* ─── Winner Cards ─── */
.qt-winners { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.qt-winner {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4);
    background: linear-gradient(135deg, var(--accent-bg), transparent);
    border: 2px solid var(--accent); border-radius: var(--radius-lg);
    animation: qtWinnerPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.qt-winner:nth-child(2) { animation-delay: 0.15s; }
.qt-winner:nth-child(3) { animation-delay: 0.3s; }
@keyframes qtWinnerPop {
    0%   { opacity: 0; transform: scale(0.5) rotate(-5deg); }
    60%  { transform: scale(1.05) rotate(1deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}
.qt-winner__rank {
    flex-shrink: 0; width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-size: 18px; font-weight: 800; color: #fff;
    background: var(--accent); box-shadow: 0 3px 10px rgba(139,92,246,0.35);
}
.qt-winner:nth-child(1) .qt-winner__rank {
    background: linear-gradient(135deg, #F59E0B, #D97706);
    box-shadow: 0 3px 10px rgba(245,158,11,0.4);
}
.qt-winner:nth-child(2) .qt-winner__rank {
    background: linear-gradient(135deg, #9CA3AF, #6B7280);
}
.qt-winner:nth-child(3) .qt-winner__rank {
    background: linear-gradient(135deg, #D97706, #92400E);
}
.qt-winner__name { font-size: var(--font-size-xl); font-weight: 700; color: var(--text-primary); }

/* ─── Person Cards ─── */
.qt-persons { display: flex; flex-wrap: wrap; gap: var(--space-3); min-height: 40px; }
.qt-person {
    display: flex; align-items: center; gap: var(--space-2);
    background: var(--bg-secondary); padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg); animation: qtChipIn 0.2s ease;
    transition: transform var(--transition-fast);
}
.qt-person:hover { transform: translateY(-1px); }
.qt-person__avatar {
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.qt-person__name { font-weight: 500; font-size: var(--font-size-sm); color: var(--text-primary); }
.qt-person__remove {
    background: none; border: none; color: var(--text-tertiary);
    cursor: pointer; font-size: 18px; padding: 0 4px; margin-left: var(--space-1);
    transition: color var(--transition-fast);
}
.qt-person__remove:hover { color: var(--error); }

/* ─── Team Cards ─── */
.qt-teams {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}
.qt-team {
    background: var(--bg-primary); border-radius: var(--radius-lg);
    padding: var(--space-4); box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--accent);
    animation: qtSlideIn 0.4s ease both;
}
.qt-team:nth-child(2) { animation-delay: 0.1s; }
.qt-team:nth-child(3) { animation-delay: 0.2s; }
.qt-team:nth-child(4) { animation-delay: 0.3s; }
.qt-team__title { font-size: var(--font-size-lg); font-weight: 600; margin-bottom: var(--space-3); }
.qt-team__members { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ─── Countdown ─── */
.qt-countdown {
    display: flex; justify-content: center; gap: var(--space-4); padding: var(--space-6) 0;
}
.qt-countdown__unit { text-align: center; }
.qt-countdown__value {
    display: block; font-size: var(--font-size-4xl); font-weight: 800;
    color: var(--accent); line-height: 1.1; min-width: 72px;
}
.qt-countdown__label {
    display: block; font-size: var(--font-size-xs); color: var(--text-tertiary);
    text-transform: uppercase; letter-spacing: 1px; margin-top: var(--space-1);
}
@media (max-width: 480px) {
    .qt-countdown { gap: var(--space-2); }
    .qt-countdown__value { font-size: var(--font-size-3xl); min-width: 56px; }
}

/* ─── Spotlight (who-pays) ─── */
.qt-spotlight { text-align: center; padding: var(--space-8) 0; }
.qt-spotlight__card {
    display: inline-flex; flex-direction: column; align-items: center;
    padding: var(--space-6); border: 3px solid var(--accent);
    border-radius: var(--radius-xl);
    animation: qtSpotlight 0.15s ease;
}
@keyframes qtSpotlight {
    from { transform: scale(0.9); opacity: 0.7; }
    to { transform: scale(1); opacity: 1; }
}
.qt-spotlight__name {
    font-size: var(--font-size-2xl); font-weight: 700;
    margin-top: var(--space-2); color: var(--text-primary);
}

/* ─── Poll ─── */
.qt-poll-option {
    display: flex; gap: var(--space-2); margin-bottom: var(--space-2); align-items: center;
}
.qt-poll-option .input { flex: 1; }
.qt-poll-option__remove {
    background: none; border: none; color: var(--error);
    font-size: 20px; cursor: pointer; padding: 0 var(--space-2); line-height: 1;
    transition: opacity var(--transition-fast);
}
.qt-poll-option__remove:hover { opacity: 0.7; }
.qt-poll-success { text-align: center; padding: var(--space-6) 0; }
.qt-poll-success__icon {
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--success); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; margin-bottom: var(--space-3);
}
.qt-poll-success__title {
    font-size: var(--font-size-xl); font-weight: 700; color: var(--text-primary);
    margin-bottom: var(--space-2);
}
.qt-poll-success__sub { font-size: var(--font-size-sm); color: var(--text-secondary); }

/* ─── Spinner Wheel ─── */
.qt-wheel-wrap { text-align: center; margin: var(--space-6) 0; position: relative; }
.qt-wheel-pointer {
    position: relative; z-index: 2; text-align: center;
    font-size: 28px; color: var(--accent); line-height: 1; margin-bottom: -10px;
}
.qt-wheel-canvas {
    display: block; margin: 0 auto; max-width: 100%;
    border-radius: 50%; box-shadow: var(--shadow-lg);
}

/* ─── AI Result ─── */
.qt-ai-result {
    margin-top: var(--space-5); padding: var(--space-5);
    background: var(--bg-secondary); border-radius: var(--radius-lg);
    border-left: 4px solid var(--accent);
    animation: qtSlideIn 0.4s ease;
}
.qt-ai-result__text {
    font-size: var(--font-size-base); line-height: 1.7;
    color: var(--text-primary); white-space: pre-wrap; word-break: break-word;
}
.qt-ai-result__actions {
    display: flex; gap: var(--space-2); margin-top: var(--space-4);
    padding-top: var(--space-3); border-top: 1px solid var(--border-light);
}
.qt-ai-loading {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-5); color: var(--text-secondary); font-size: var(--font-size-sm);
}
.qt-ai-loading__dots { display: inline-flex; gap: 4px; }
.qt-ai-loading__dots span {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent); opacity: 0.3;
    animation: qtDotPulse 1.2s ease infinite;
}
.qt-ai-loading__dots span:nth-child(2) { animation-delay: 0.2s; }
.qt-ai-loading__dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes qtDotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

/* AI Corrections (spell-check) */
.qt-corrections { margin-top: var(--space-4); }
.qt-correction {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-3); background: var(--bg-tertiary);
    border-radius: var(--radius-sm); margin-bottom: var(--space-2);
    font-size: var(--font-size-sm);
}
.qt-correction__old { color: var(--error); text-decoration: line-through; }
.qt-correction__arrow { color: var(--text-tertiary); }
.qt-correction__new { color: var(--success); font-weight: 600; }
.qt-correction__type {
    margin-left: auto; font-size: var(--font-size-xs); color: var(--text-tertiary);
    background: var(--bg-secondary); padding: 2px 8px; border-radius: var(--radius-full);
}

/* AI Char counter */
.qt-char-counter {
    display: block; text-align: right; font-size: var(--font-size-xs);
    color: var(--text-tertiary); margin-top: var(--space-1);
}

/* ─── Confetti ─── */
.qt-confetti {
    position: absolute; width: 8px; height: 8px; border-radius: 2px;
    top: 0; opacity: 1; pointer-events: none;
    animation: qtConfettiFall 1.2s ease-out forwards;
}
@keyframes qtConfettiFall {
    0%   { transform: translateY(-20px) rotate(0deg) scale(1); opacity: 1; }
    100% { transform: translateY(200px) rotate(720deg) scale(0.3); opacity: 0; }
}
