/* ========================================
   BEE CLICKER PREMIUM ENHANCEMENTS
   Phase 2-6: Layout, Interactions, Accessibility
   ======================================== */

/* === RESPONSIVE GRID IMPROVEMENTS === */

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
    .bb-layout {
        grid-template-columns: 1fr 340px;
        grid-template-areas:
            "center shop"
            "tasks tasks";
        gap: 16px;
        padding: 16px;
    }

    .bb-panel.left-panel {
        grid-area: tasks;
    }

    .bb-panel.center {
        grid-area: center;
    }

    .bb-panel.right-panel {
        grid-area: shop;
    }

    .bb-top {
        padding: 14px 20px;
    }

    .bb-top h1 {
        font-size: 1.5rem;
    }
}

/* Mobile (<768px) */
@media (max-width: 767px) {
    .bb-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "center"
            "shop"
            "tasks";
        gap: 12px;
        padding: 12px;
    }

    .bb-top {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .bb-currency-bar {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .bb-currency-item {
        flex: 1;
        justify-content: center;
        font-size: 0.95rem;
        padding: 6px 12px;
    }

    .bb-panel {
        padding: 16px;
    }

    .bb-big-honey {
        font-size: 8rem;
    }

    #bb-honey-count {
        font-size: 2.5rem;
    }
}

/* === HERO BEE CLICK ENHANCEMENTS === */

/* Enhanced click feedback with ripple effect */
.bb-click-ripple {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    pointer-events: none;
    animation: ripple-expand 0.6s ease-out forwards;
    opacity: 0.6;
}

@keyframes ripple-expand {
    from {
        width: 0;
        height: 0;
        opacity: 0.8;
    }

    to {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* Floating honey text on click */
.bb-honey-popup {
    position: absolute;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-secondary);
    text-shadow: var(--glow-accent), 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    animation: float-up-honey 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    z-index: 10;
}

@keyframes float-up-honey {
    0% {
        transform: translateY(0) scale(0.8);
        opacity: 1;
    }

    50% {
        transform: translateY(-60px) scale(1.1);
        opacity: 1;
    }

    100% {
        transform: translateY(-120px) scale(0.6);
        opacity: 0;
    }
}

/* Honey particle effects */
.bb-honey-particle {
    position: absolute;
    font-size: 1.2rem;
    pointer-events: none;
    animation: particle-drift 1.5s ease-out forwards;
    opacity: 0.9;
}

@keyframes particle-drift {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 0.9;
    }

    100% {
        transform: translate(var(--drift-x, 0), var(--drift-y, -100px)) rotate(var(--drift-rot, 180deg)) scale(0.3);
        opacity: 0;
    }
}

/* Enhanced idle animation for big bee */
.bb-big-honey {
    animation: bb-float-gentle 4s ease-in-out infinite, bb-subtle-rotate 8s ease-in-out infinite;
}

@keyframes bb-subtle-rotate {

    0%,
    100% {
        filter: drop-shadow(0 8px 24px var(--accent-primary)) hue-rotate(0deg);
    }

    50% {
        filter: drop-shadow(0 12px 32px var(--accent-primary)) hue-rotate(10deg);
    }
}

/* Combo streak meter */
.bb-combo-meter {
    position: absolute;
    top: 24px;
    right: 24px;
    background: var(--panel-bg);
    border: 2px solid var(--accent-primary);
    border-radius: 20px;
    padding: 8px 16px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: var(--shadow-medium), var(--glow-accent);
}

.bb-combo-meter.active {
    opacity: 1;
    transform: translateY(0);
}

.bb-combo-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.bb-combo-bar {
    width: 120px;
    height: 6px;
    background: var(--panel-bg-light);
    border-radius: 3px;
    overflow: hidden;
}

.bb-combo-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.1s linear;
    box-shadow: 0 0 8px var(--accent-primary);
}

/* === SHOP CARD ENTRANCE ANIMATIONS === */

.bb-shop-item {
    animation: card-slide-in 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.bb-shop-item:nth-child(1) {
    animation-delay: 0.05s;
}

.bb-shop-item:nth-child(2) {
    animation-delay: 0.1s;
}

.bb-shop-item:nth-child(3) {
    animation-delay: 0.15s;
}

.bb-shop-item:nth-child(4) {
    animation-delay: 0.2s;
}

.bb-shop-item:nth-child(5) {
    animation-delay: 0.25s;
}

@keyframes card-slide-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === ENHANCED BUTTON MICRO-INTERACTIONS === */

.bb-shop-item button,
.bb-card-button,
.bb-tab,
#bb-bulk-btn,
#bb-phone-btn {
    position: relative;
    overflow: hidden;
}

.bb-shop-item button::before,
.bb-card-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.bb-shop-item button:active::before,
.bb-card-button:active::before {
    width: 300px;
    height: 300px;
}

/* Enhanced hover lift for all interactive elements */
.bb-shop-item:hover,
.bb-task-card:hover {
    transform: translateY(-3px);
}

.bb-shop-item button:hover,
.bb-card-button:hover,
.bb-tab:hover:not(.active),
#bb-bulk-btn:hover,
#bb-phone-btn:hover {
    transform: translateY(-2px);
}

/* === PROGRESS BAR SMOOTH INTERPOLATION === */

.bb-task-progress-fill,
.bb-card-progress-fill,
.bb-combo-fill {
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Glowing progress bars */
.bb-task-progress-fill,
.bb-card-progress-fill {
    box-shadow: 0 0 8px var(--accent-primary);
}

/* === ACCESSIBILITY ENHANCEMENTS === */

/* Focus rings for keyboard navigation */
.bb-shop-item button:focus,
.bb-card-button:focus,
.bb-tab:focus,
#bb-bulk-btn:focus,
#bb-search:focus,
#bb-phone-btn:focus,
.bb-settings-btn:focus,
.back-btn:focus {
    outline: 3px solid var(--accent-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--panel-glow);
}

/* Enhanced focus for better visibility */
.bb-big-honey:focus {
    outline: 4px dashed var(--accent-primary);
    outline-offset: 8px;
}

/* Touch target minimum size for mobile */
@media (max-width: 767px) {

    .bb-shop-item button,
    .bb-card-button,
    .bb-tab,
    #bb-bulk-btn,
    #bb-phone-btn,
    .bb-settings-btn {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }
}

/* === REDUCED MOTION SUPPORT === */

@media (prefers-reduced-motion: reduce) {

    .bb-big-honey,
    .bb-visual-bee,
    .bb-click-ripple,
    .bb-honey-popup,
    .bb-honey-particle,
    .bb-shop-item,
    .bb-combo-meter {
        animation: none !important;
    }

    .bb-shop-item button::before,
    .bb-card-button::before {
        display: none;
    }

    * {
        transition-duration: 0.05s !important;
    }
}

/* === SCROLLBAR STYLING === */

.bb-scroll-list::-webkit-scrollbar {
    width: 12px;
}

.bb-scroll-list::-webkit-scrollbar-track {
    background: var(--panel-bg-light);
    border-radius: 10px;
    border: 2px solid var(--panel-bg);
}

.bb-scroll-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 10px;
    border: 2px solid var(--panel-bg-light);
    transition: all 0.2s ease;
}

.bb-scroll-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gradient);
    box-shadow: 0 0 10px var(--accent-primary);
}

/* === TASK CARD ENHANCEMENTS === */

.bb-task-card {
    background: var(--panel-bg-light);
    border: 2px solid var(--panel-border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bb-task-card:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-soft), 0 0 16px var(--panel-glow);
}

.bb-task-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.bb-task-progress {
    height: 6px;
    background: var(--panel-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.bb-task-reward {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--success);
    color: var(--text-inverse);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 8px;
}

/* === BUFF CHIP STYLING === */

.bb-buff-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--accent-gradient);
    color: var(--text-inverse);
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: var(--shadow-soft), 0 0 12px var(--accent-primary);
    animation: buff-pulse 2s ease-in-out infinite;
    margin-right: 8px;
    margin-bottom: 8px;
}

@keyframes buff-pulse {

    0%,
    100% {
        box-shadow: var(--shadow-soft), 0 0 12px var(--accent-primary);
    }

    50% {
        box-shadow: var(--shadow-medium), 0 0 20px var(--accent-primary);
    }
}

/* === SHOP ITEM AFFORDABILITY STATES === */

.bb-shop-item.affordable {
    border-color: var(--success);
}

.bb-shop-item.favorite {
    border-color: #fbbf24;
    box-shadow: var(--shadow-soft), 0 0 18px rgba(251, 191, 36, 0.2);
}

.bb-shop-item.affordable:hover {
    border-color: var(--success);
    box-shadow: var(--shadow-medium), 0 0 20px var(--success);
}

.bb-shop-item.locked {
    opacity: 0.5;
    filter: grayscale(60%);
}

.bb-shop-item.locked:hover {
    transform: none;
    cursor: not-allowed;
}

/* === BEE ROW IMPROVEMENTS === */

.bb-visual-bee {
    transition: transform 0.3s ease;
}

.bb-visual-bee:hover {
    transform: scale(1.2) translateY(-5px);
    filter: drop-shadow(0 4px 12px var(--accent-primary));
}

/* === PHONE BUTTON PREMIUM STYLING === */

#bb-phone-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--btn-primary-bg);
    color: var(--text-inverse);
    border: none;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#bb-phone-btn:hover {
    box-shadow: var(--glow-accent), var(--shadow-strong);
    transform: translateY(-3px) scale(1.02);
}

#bb-phone-btn:active {
    transform: translateY(-1px) scale(0.98);
}

/* === LOADING STATES === */

.bb-loading {
    position: relative;
    overflow: hidden;
}

.bb-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--panel-glow), transparent);
    animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
    to {
        left: 100%;
    }
}

/* === SECTION HEADERS === */

.bb-section-header {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    text-shadow: var(--glow-accent);
}

.bb-pin-btn {
    margin-top: 8px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.9);
    color: var(--text-primary);
    padding: 8px 10px;
    font-weight: 700;
    cursor: pointer;
}

.bb-prestige-content,
.bb-royal-content {
    background: linear-gradient(180deg, rgba(20, 24, 39, 0.98), rgba(40, 25, 10, 0.96));
    border: 1px solid rgba(251, 191, 36, 0.28);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45), 0 0 30px rgba(251, 191, 36, 0.1);
}

.bb-prestige-stats p,
.bb-royal-desc {
    color: var(--text-secondary);
}

.bb-jelly-val,
.bb-jelly-display,
.bb-royal-cost {
    color: #fbbf24;
    font-weight: 800;
}

.bb-phone-home-remix {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bb-phone-hero {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.94), rgba(120, 53, 15, 0.7));
    border: 1px solid rgba(251, 191, 36, 0.18);
}

.bb-phone-kicker {
    margin: 0 0 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #fbbf24;
}

.bb-phone-hero h3 {
    margin: 0 0 6px;
    color: #fff7d6;
}

.bb-phone-hero p {
    margin: 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
}

.bb-phone-hero-badge {
    align-self: flex-start;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(251, 191, 36, 0.12);
    color: #fbbf24;
    font-weight: 800;
}

.bb-phone-app-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.icon-bubble.arcade {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
}

.icon-bubble.rebirth {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
}

.bb-arcade-map {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.bb-arcade-header {
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(37, 99, 235, 0.4));
    border: 1px solid rgba(96, 165, 250, 0.2);
}

.bb-arcade-header h3 {
    margin: 0 0 4px;
    color: #dbeafe;
}

.bb-arcade-header p {
    margin: 0;
    color: rgba(219, 234, 254, 0.74);
}

.bb-arcade-grid {
    display: grid;
    gap: 10px;
}

.bb-arcade-card {
    padding: 14px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.bb-arcade-card.unlocked {
    cursor: pointer;
}

.bb-arcade-card.unlocked:hover {
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, 0.35);
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.18);
}

.bb-arcade-card.locked {
    opacity: 0.6;
}

.bb-arcade-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.bb-arcade-icon {
    font-size: 1.6rem;
}

.bb-arcade-state {
    font-size: 0.78rem;
    color: #93c5fd;
}

.bb-arcade-card h4 {
    margin: 0 0 6px;
    color: #f8fafc;
}

.bb-arcade-card p {
    margin: 0 0 12px;
    color: rgba(248, 250, 252, 0.7);
    font-size: 0.9rem;
}

.bb-arcade-btn {
    width: 100%;
    padding: 9px 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #1d4ed8, #06b6d4);
    color: white;
    font-weight: 700;
}

.bb-arcade-btn:disabled {
    background: rgba(71, 85, 105, 0.9);
}

/* === ENHANCED CURRENCY PULSE ON GAIN === */

.bb-currency-value.pulse {
    animation: currency-pulse 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes currency-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
        color: var(--accent-secondary);
        text-shadow: 0 0 16px var(--accent-primary);
    }
}
