/* ═══════════════════════════════════════════════════════════════════
   CIFRATURN — PREMIUM BASE SYSTEM
   Shared styles for Index, Cifra and Artist pages
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --brand-500: #ff6b35;
    --brand-600: #ea580c;
    --dark-950: #080c14;
    --dark-900: #0b1120;
    --dark-800: #0e1621;
    --dark-700: #131d2e;
}

body.ct-redesign {
    background-color: var(--dark-950);
    color: #e2e8f0;
    font-family: 'Inter', sans-serif;
}

/* ── Sticky Header ────────────────────────── */
.ct-header {
    position: sticky;
    top: 0;
    z-index: 9999;
    background: rgba(11,17,32,0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    transition: background 0.3s, box-shadow 0.3s;
}

.ct-header.scrolled {
    background: rgba(8,12,20,0.95);
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

/* ── Search Wrap base ──────────────────── */
.ct-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* ── Search Field Wrapper ──────────────── */
#ct-search-field {
    position: relative;
    width: 0;
    height: 0;
    overflow: hidden;
    transition: width 0.35s cubic-bezier(0.4,0,0.2,1),
                height 0.35s cubic-bezier(0.4,0,0.2,1);
}

.ct-search-wrap.expanded #ct-search-field {
    width: 260px;
    height: 40px;
    overflow: visible;
}

/* ── Search Input ──────────────────────── */
.ct-search-input {
    width: 100%;
    height: 100%;
    padding: 0 14px 0 36px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    caret-color: #ff6b35;
}

.ct-search-input::placeholder { color: rgba(255,255,255,0.35); }
.ct-search-input:focus { border-color: rgba(255,107,53,0.5); background: rgba(255,255,255,0.1); }

.ct-search-wrap.expanded .ct-search-input { pointer-events: auto; }

/* Light theme overrides */
body.ct-redesign.theme-light .ct-search-input {
    background: rgba(0,0,0,0.06) !important;
    border-color: rgba(0,0,0,0.15) !important;
    color: #1e293b !important;
    caret-color: #ff6b35;
}
body.ct-redesign.theme-light .ct-search-input::placeholder { color: rgba(0,0,0,0.35) !important; }
body.ct-redesign.theme-light .ct-search-input:focus { border-color: rgba(255,107,53,0.5) !important; background: rgba(0,0,0,0.08) !important; }

.ct-inner-search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.35);
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s;
    z-index: 1;
}

.ct-search-wrap.expanded .ct-inner-search-icon {
    opacity: 1;
}

body.ct-redesign.theme-light .ct-inner-search-icon {
    color: rgba(0,0,0,0.35) !important;
}

/* ── Mobile Header Tweaks ─────────────────── */
@media (max-width: 640px) {
    .ct-search-wrap.expanded .ct-search-input {
        width: 200px;
    }
    .ct-search-wrap.expanded {
        position: absolute;
        left: 12px;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        background: var(--dark-800);
        border-radius: 12px;
        z-index: 1001;
        width: auto !important;
        border: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    }
    .ct-search-wrap.expanded input {
        width: 100% !important;
        background: transparent !important;
        display: block !important;
    }
}

/* SEARCH RESULTS DROPDOWN */
#search-results, .search-suggestions {
    display: none;                                          /* JS usa inline style para mostrar */
    position: absolute !important;
    top: calc(100% + 6px) !important;
    left: 0 !important;
    right: auto !important;
    min-width: 280px;
    width: max-content !important;
    max-width: min(420px, 90vw) !important;
    background: #0b1120 !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5) !important;
    max-height: 400px !important;
    overflow-y: auto !important;
    z-index: 9999 !important;
}

.search-category {
    padding: 12px 16px 8px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    color: rgba(255,255,255,0.3) !important;
    background: rgba(255,255,255,0.02) !important;
    border-top: 1px solid rgba(255,255,255,0.05) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.search-no-results {
    padding: 30px 20px !important;
    text-align: center !important;
    color: rgba(255,255,255,0.4) !important;
}


/* ══════════════════════════════════════════════════════════════
   MOBILE HEADER — FIX COMPLETO
   Corrige: logo height, overflow, search expand, alinhamento
══════════════════════════════════════════════════════════════ */

/* Fix logo img (ct-dark-theme define height:auto que deforma o logo) */
#ct-logo img {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    min-height: 36px;
    object-fit: contain;
}

/* Garantir que o header não transborda */
.ct-header {
    overflow: visible;
}

.ct-header > div {
    position: relative;  /* ancora o search expand */
    min-height: 56px;
    max-width: 100%;
    box-sizing: border-box;
}

/* ── Breakpoint 640px ────────────────────── */
@media (max-width: 640px) {
    .ct-header > div {
        height: 56px;
        padding-left: 12px !important;
        padding-right: 12px !important;
        gap: 8px !important;
    }

    #ct-logo h1 {
        font-size: 17px !important;
        letter-spacing: -0.5px;
    }

    #ct-logo img {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px;
        min-height: 30px;
    }

    /* Search expand: overlay de largura total */
    .ct-search-wrap.expanded {
        position: absolute !important;
        left: 10px !important;
        right: 10px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        background: var(--dark-800) !important;
        border-radius: 12px !important;
        z-index: 1001 !important;
        width: auto !important;
        border: 1px solid rgba(255,255,255,0.12) !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
        display: flex !important;
        align-items: center !important;
        padding: 4px 8px !important;
    }

    /* Botões pequenos em mobile */
    #btn-theme-toggle,
    #btn-theme-toggle-idx {
        width: 34px !important;
        height: 34px !important;
        flex-shrink: 0;
    }
}

/* ── Breakpoint 360px ────────────────────── */
@media (max-width: 375px) {
    .ct-header > div {
        padding-left: 8px !important;
        padding-right: 8px !important;
        gap: 4px !important;
    }

    #ct-logo h1 {
        font-size: 15px !important;
    }

    #ct-logo img {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px;
        min-height: 26px;
    }
}
