/* ═══════════════════════════════════════════════════
   SIDEBAR / CONTROLS PANEL  — sidebar.css
   Depends on CSS variables defined in tiles.css
═══════════════════════════════════════════════════ */

/* ═══ PANEL WRAPPER ═══════════════════════════════ */
.controls-panel {
    background: linear-gradient(160deg, rgba(13, 33, 55, .92) 0%, rgba(10, 18, 25, .95) 100%);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    backdrop-filter: blur(18px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45), 0 0 0 1px rgba(30, 144, 255, .05);
    position: relative;
    outline: none !important;
    animation: panelIn .65s .15s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateX(20px) scale(.98);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.controls-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--blue), var(--blue-light), var(--blue), transparent);
    animation: topGlow 3s ease-in-out infinite;
}

@keyframes topGlow {

    0%,
    100% {
        opacity: .35
    }

    50% {
        opacity: .9
    }
}

/* ═══ PANEL TABS ══════════════════════════════════ */
.panel-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: rgba(10, 18, 25, .5);
    flex-shrink: 0;
}

.panel-tab {
    flex: 1;
    padding: 14px 10px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all .3s ease;
    font-family: "Acme", sans-serif;
    font-size: .875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    position: relative;
    overflow: hidden;
}

.panel-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    right: 50%;
    height: 2px;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    transition: left .3s ease, right .3s ease;
    border-radius: 2px;
}

.panel-tab.active {
    color: var(--blue-light);
    background: rgba(30, 144, 255, .08);
}

.panel-tab.active::after {
    left: 10%;
    right: 10%;
}

.panel-tab:hover:not(.active) {
    color: var(--text);
    background: rgba(255, 255, 255, .04);
}

/* ═══ PANEL CONTENT ═══════════════════════════════ */
.panel-content {
    padding: 14px;
    overflow-y: auto;
    flex: 1;
}

.panel-content::-webkit-scrollbar {
    width: 5px;
}

.panel-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, .03);
    border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.panel-content::-webkit-scrollbar-thumb:hover {
    background: var(--blue);
}

/* ═══ TILE INFO BOX ═══════════════════════════════ */
.tile-info {
    background: linear-gradient(135deg, rgba(30, 144, 255, .1) 0%, rgba(13, 33, 55, .8) 100%);
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    border: 1px solid rgba(30, 144, 255, .22);
    position: relative;
    overflow: hidden;
}

.tile-info::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(30, 144, 255, .15), transparent 70%);
    pointer-events: none;
}

.tile-info h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: var(--blue-light);
    letter-spacing: .3px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.info-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
}

.info-value {
    font-size: .85rem;
    color: var(--text);
    font-weight: 400;
}

/* ═══ FILTER BAR ══════════════════════════════════ */
.filter-bar {
    background: rgba(30, 144, 255, .07);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border: 1px solid rgba(30, 144, 255, .15);
}

.filter-bar .filter-label {
    font-size: .7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .6px;
    margin-bottom: 8px;
    display: block;
}

.filter-btn {
    padding: 5px 14px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 50px;
    color: var(--text-muted);
    font-size: .75rem;
    cursor: pointer;
    transition: all .25s ease;
    font-family: "Acme", sans-serif;
    white-space: nowrap;
}

.filter-btn:hover {
    border-color: var(--blue);
    color: var(--text);
    background: rgba(30, 144, 255, .1);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--blue), var(--blue-light));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 3px 12px var(--blue-glow);
}

/* ═══ SECTION TITLE ═══════════════════════════════ */
.section-title {
    font-size: .78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .7px;
    margin-bottom: 10px;
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

/* ═══ TILE CARD ═══════════════════════════════════ */
.tile-card {
    background: rgba(13, 33, 55, .7);
    border: 1.5px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    transition: all .3s cubic-bezier(.16, 1, .3, 1);
    position: relative;
}

.tile-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(30, 144, 255, .08), transparent);
    opacity: 0;
    transition: opacity .3s;
    border-radius: var(--radius-sm);
    pointer-events: none;
    z-index: 1;
}

.tile-card:hover {
    border-color: var(--blue);
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35), 0 0 0 1px rgba(30, 144, 255, .2);
}

.tile-card:hover::before {
    opacity: 1;
}

.tile-card.active {
    border-color: var(--blue-light);
    box-shadow: 0 0 0 2px rgba(30, 144, 255, .3), 0 8px 24px rgba(30, 144, 255, .2);
}

.tile-card.active::before {
    opacity: 1;
}

/* Selected checkmark badge */
.tile-card.active::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--blue);
    border-radius: 50%;
    font-size: .65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(30, 144, 255, .5);
}

/* ═══ TILE IMAGE ══════════════════════════════════ */
.tile-image {
    width: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 110px;
    transition: transform .4s ease;
}

.tile-card:hover .tile-image {
    transform: scale(1.05);
}

.tile-image.tile-grid-preview {
    height: auto;
    min-height: 75px;
}

@media (max-width: 576px) {
    .tile-image {
        height: 65px;
    }

    .tile-image.tile-grid-preview {
        min-height: 48px;
    }
}

@media (min-width: 577px) and (max-width: 991px) {
    .tile-image {
        height: 85px;
    }

    .tile-image.tile-grid-preview {
        min-height: 60px;
    }
}

@media (min-width: 992px) and (max-width: 1199px) {
    .tile-image {
        height: 95px;
    }

    .tile-image.tile-grid-preview {
        min-height: 68px;
    }
}

@media (min-width: 1200px) {
    .tile-image {
        height: 110px;
    }

    .tile-image.tile-grid-preview {
        min-height: 75px;
    }
}

/* ═══ TILE DETAILS ════════════════════════════════ */
.tile-details {
    padding: 7px 10px 8px;
    position: relative;
    z-index: 2;
}

.tile-name {
    font-weight: 600;
    font-size: .78rem;
    margin-bottom: 2px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tile-size {
    font-size: .68rem;
    color: var(--text-muted);
}

/* ═══ PATTERN TILE SELECTOR ═══════════════════════ */
.pattern-tile-selector {
    background: rgba(30, 144, 255, .06);
    border: 1px solid rgba(30, 144, 255, .18);
    border-radius: var(--radius-sm);
    margin-top: 10px;
    overflow: hidden;
    max-height: 0;
    transition: max-height .4s cubic-bezier(.16, 1, .3, 1);
}

.pattern-tile-selector.visible {
    max-height: 2000px;
    padding: 12px;
}

.pattern-tile-selector .section-title {
    color: var(--blue-light);
}

/* ═══ RESPONSIVE ══════════════════════════════════ */
@media (max-width: 991.98px) {
    .controls-panel {
        max-height: none;
    }

    .panel-content {
        padding: 12px;
    }
}

@media (max-width: 767.98px) {
    .panel-tab {
        padding: 12px 8px;
        font-size: .78rem;
    }

    .filter-btn {
        font-size: .7rem;
        padding: 4px 10px;
    }
}