/* ═══════════════════════════════════════════════════════════════════════
   Global Icon Buttons — colorful pill-shaped buttons with gradient icons
   Usage: <a class="icon-btn icon-btn--{color}" href="...">
            <span class="icon-btn__icon"><svg ...></span>
            <span class="icon-btn__label">Label</span>
          </a>
   Colors: blue, purple, green, emerald, amber, rose, cyan, indigo, slate
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Base ─────────────────────────────────────────────────────────── */
.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem 0.45rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    position: relative;       /* anchor for CSS tooltips */
    /* default (slate) bg */
    background: rgba(100, 116, 139, 0.08);
    color: #334155;
}

/* ─── Tooltip fix: suppress global [title] CSS tooltip on icon buttons ─── */
/* The global stylesheet creates ::before/::after tooltips from [title].
   We suppress them on .icon-btn to avoid doubling with the native tooltip.
   A companion <script> in base.html converts title→data-tooltip and removes
   the native tooltip, then we re-enable the CSS tooltip only when the
   label is hidden (icon-only, or --sm on mobile). */
.icon-btn::before,
.icon-btn::after {
    content: none !important;
    display: none !important;
}
/* Re-enable CSS tooltip for icon-only variant (label is always hidden) */
.icon-btn--icon-only[data-tooltip]:hover::after {
    content: attr(data-tooltip) !important;
    display: block !important;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #f1f5f9;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.icon-btn--icon-only[data-tooltip]:hover::before {
    content: '' !important;
    display: block !important;
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
    z-index: 1000;
    pointer-events: none;
}
/* Re-enable CSS tooltip for --sm on mobile when label is hidden */
@media (max-width: 767px) {
    .icon-btn--sm[data-tooltip]:hover::after {
        content: attr(data-tooltip) !important;
        display: block !important;
        position: absolute;
        bottom: calc(100% + 10px);
        left: 50%;
        transform: translateX(-50%);
        padding: 6px 12px;
        border-radius: 8px;
        font-size: 0.75rem;
        font-weight: 500;
        white-space: nowrap;
        z-index: 1000;
        pointer-events: none;
        background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
        color: #f1f5f9;
        border: 1px solid rgba(255,255,255,0.08);
        box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    }
    .icon-btn--sm[data-tooltip]:hover::before {
        content: '' !important;
        display: block !important;
        position: absolute;
        bottom: calc(100% + 4px);
        left: 50%;
        transform: translateX(-50%);
        border: 5px solid transparent;
        border-top-color: #1e293b;
        z-index: 1000;
        pointer-events: none;
    }
}
.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.icon-btn:active {
    transform: translateY(0);
}
.icon-btn:disabled,
.icon-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.icon-btn:disabled:hover,
.icon-btn[disabled]:hover {
    transform: none;
    box-shadow: none;
}

/* ─── Icon circle ──────────────────────────────────────────────────── */
.icon-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.icon-btn__icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    color: #fff;
    stroke: #fff;
}

/* ─── Label ────────────────────────────────────────────────────────── */
.icon-btn__label {
    display: inline;
}

/* ═══════════════════════════════════════════════════════════════════════
   Color Variants
   ═══════════════════════════════════════════════════════════════════════ */

/* Blue */
.icon-btn--blue { background: rgba(59, 130, 246, 0.08); color: #1e40af; }
.icon-btn--blue .icon-btn__icon { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.icon-btn--blue:hover { background: rgba(59, 130, 246, 0.15); color: #1e40af; box-shadow: 0 4px 14px rgba(59,130,246,0.25); }

/* Purple */
.icon-btn--purple { background: rgba(139, 92, 246, 0.08); color: #5b21b6; }
.icon-btn--purple .icon-btn__icon { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.icon-btn--purple:hover { background: rgba(139, 92, 246, 0.15); color: #5b21b6; box-shadow: 0 4px 14px rgba(139,92,246,0.25); }

/* Green */
.icon-btn--green { background: rgba(34, 197, 94, 0.08); color: #166534; }
.icon-btn--green .icon-btn__icon { background: linear-gradient(135deg, #22c55e, #16a34a); }
.icon-btn--green:hover { background: rgba(34, 197, 94, 0.15); color: #166534; box-shadow: 0 4px 14px rgba(34,197,94,0.25); }

/* Emerald */
.icon-btn--emerald { background: rgba(16, 185, 129, 0.08); color: #065f46; }
.icon-btn--emerald .icon-btn__icon { background: linear-gradient(135deg, #10b981, #059669); }
.icon-btn--emerald:hover { background: rgba(16, 185, 129, 0.15); color: #065f46; box-shadow: 0 4px 14px rgba(16,185,129,0.25); }

/* Amber */
.icon-btn--amber { background: rgba(245, 158, 11, 0.08); color: #92400e; }
.icon-btn--amber .icon-btn__icon { background: linear-gradient(135deg, #f59e0b, #d97706); }
.icon-btn--amber:hover { background: rgba(245, 158, 11, 0.15); color: #92400e; box-shadow: 0 4px 14px rgba(245,158,11,0.25); }

/* Rose */
.icon-btn--rose { background: rgba(244, 63, 94, 0.08); color: #9f1239; }
.icon-btn--rose .icon-btn__icon { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.icon-btn--rose:hover { background: rgba(244, 63, 94, 0.15); color: #9f1239; box-shadow: 0 4px 14px rgba(244,63,94,0.25); }

/* Cyan */
.icon-btn--cyan { background: rgba(6, 182, 212, 0.08); color: #155e75; }
.icon-btn--cyan .icon-btn__icon { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.icon-btn--cyan:hover { background: rgba(6, 182, 212, 0.15); color: #155e75; box-shadow: 0 4px 14px rgba(6,182,212,0.25); }

/* Indigo */
.icon-btn--indigo { background: rgba(99, 102, 241, 0.08); color: #3730a3; }
.icon-btn--indigo .icon-btn__icon { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.icon-btn--indigo:hover { background: rgba(99, 102, 241, 0.15); color: #3730a3; box-shadow: 0 4px 14px rgba(99,102,241,0.25); }

/* Slate (default / neutral) */
.icon-btn--slate { background: rgba(100, 116, 139, 0.08); color: #334155; }
.icon-btn--slate .icon-btn__icon { background: linear-gradient(135deg, #64748b, #475569); }
.icon-btn--slate:hover { background: rgba(100, 116, 139, 0.15); color: #334155; box-shadow: 0 4px 14px rgba(100,116,139,0.2); }

/* ═══════════════════════════════════════════════════════════════════════
   Dark Mode
   ═══════════════════════════════════════════════════════════════════════ */
.dark .icon-btn,
html.dark .icon-btn,
[data-theme="dark"] .icon-btn {
    background: rgba(255,255,255,0.04);
    color: #e2e8f0;
}
.dark .icon-btn:hover,
html.dark .icon-btn:hover,
[data-theme="dark"] .icon-btn:hover {
    background: rgba(255,255,255,0.08);
    color: #f8fafc;
}

.dark .icon-btn--blue,
html.dark .icon-btn--blue { background: rgba(59,130,246,0.12); color: #93c5fd; }
.dark .icon-btn--blue:hover,
html.dark .icon-btn--blue:hover { background: rgba(59,130,246,0.2); color: #bfdbfe; }

.dark .icon-btn--purple,
html.dark .icon-btn--purple { background: rgba(139,92,246,0.12); color: #c4b5fd; }
.dark .icon-btn--purple:hover,
html.dark .icon-btn--purple:hover { background: rgba(139,92,246,0.2); color: #ddd6fe; }

.dark .icon-btn--green,
html.dark .icon-btn--green { background: rgba(34,197,94,0.12); color: #86efac; }
.dark .icon-btn--green:hover,
html.dark .icon-btn--green:hover { background: rgba(34,197,94,0.2); color: #bbf7d0; }

.dark .icon-btn--emerald,
html.dark .icon-btn--emerald { background: rgba(16,185,129,0.12); color: #6ee7b7; }
.dark .icon-btn--emerald:hover,
html.dark .icon-btn--emerald:hover { background: rgba(16,185,129,0.2); color: #a7f3d0; }

.dark .icon-btn--amber,
html.dark .icon-btn--amber { background: rgba(245,158,11,0.12); color: #fcd34d; }
.dark .icon-btn--amber:hover,
html.dark .icon-btn--amber:hover { background: rgba(245,158,11,0.2); color: #fde68a; }

.dark .icon-btn--rose,
html.dark .icon-btn--rose { background: rgba(244,63,94,0.12); color: #fda4af; }
.dark .icon-btn--rose:hover,
html.dark .icon-btn--rose:hover { background: rgba(244,63,94,0.2); color: #fecdd3; }

.dark .icon-btn--cyan,
html.dark .icon-btn--cyan { background: rgba(6,182,212,0.12); color: #67e8f9; }
.dark .icon-btn--cyan:hover,
html.dark .icon-btn--cyan:hover { background: rgba(6,182,212,0.2); color: #a5f3fc; }

.dark .icon-btn--indigo,
html.dark .icon-btn--indigo { background: rgba(99,102,241,0.12); color: #a5b4fc; }
.dark .icon-btn--indigo:hover,
html.dark .icon-btn--indigo:hover { background: rgba(99,102,241,0.2); color: #c7d2fe; }

.dark .icon-btn--slate,
html.dark .icon-btn--slate { background: rgba(148,163,184,0.1); color: #cbd5e1; }
.dark .icon-btn--slate:hover,
html.dark .icon-btn--slate:hover { background: rgba(148,163,184,0.18); color: #e2e8f0; }

/* ═══════════════════════════════════════════════════════════════════════
   Size Variants
   ═══════════════════════════════════════════════════════════════════════ */
.icon-btn--sm {
    padding: 0.3rem 0.75rem 0.3rem 0.35rem;
    font-size: 0.75rem;
    gap: 0.35rem;
}
.icon-btn--sm .icon-btn__icon { width: 26px; height: 26px; }
.icon-btn--sm .icon-btn__icon svg { width: 13px; height: 13px; }

/* Hide labels on small screens for compact toolbar buttons */
@media (max-width: 767px) {
    .icon-btn--sm .icon-btn__label { display: none; }
    .icon-btn--sm { padding: 0.3rem; }
}

.icon-btn--lg {
    padding: 0.55rem 1.25rem 0.55rem 0.6rem;
    font-size: 0.875rem;
    gap: 0.6rem;
}
.icon-btn--lg .icon-btn__icon { width: 38px; height: 38px; }
.icon-btn--lg .icon-btn__icon svg { width: 18px; height: 18px; }

/* ─── Icon-only variant (no label) ─────────────────────────────────── */
.icon-btn--icon-only {
    padding: 0.35rem;
    border-radius: 50%;
}
.icon-btn--icon-only .icon-btn__label { display: none; }
