/* ASG Premium Theme 2026 (Default) */
body[data-theme="asg-premium"] {
    --bg-color: #050505;
    --surface-color: #121212;
    --surface-hover: #1a1a1a;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --accent-color: #8b5cf6;
    --accent-hover: #a78bfa;
    --danger-color: #f43f5e;
    --success-color: #10b981;
    --sidebar-bg: rgba(5, 5, 5, 0.85);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    --glass-bg: rgba(18, 18, 18, 0.7);
    --skeleton-base: #1f1f22;
    --skeleton-highlight: #2f2f35;
    --modal-overlay: rgba(0, 0, 0, 0.8);
    --gradient-start: #8b5cf6;
    --gradient-end: #3b82f6;
}

/* ASG Glassmorphism Theme */
body[data-theme="asg-glass"] {
    --bg-color: #eef2f6;
    --surface-color: rgba(255, 255, 255, 0.7);
    --surface-hover: rgba(255, 255, 255, 0.9);
    --border-color: rgba(255, 255, 255, 0.8);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --danger-color: #e11d48;
    --success-color: #059669;
    --sidebar-bg: rgba(255, 255, 255, 0.6);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.6);
    --skeleton-base: #e2e8f0;
    --skeleton-highlight: #f8fafc;
    --modal-overlay: rgba(15, 23, 42, 0.3);
    --gradient-start: #6366f1;
    --gradient-end: #ec4899;
}

/* Bento Grid Theme (Apple Style) */
body[data-theme="bento"] {
    --bg-color: #f7f7f8;
    --surface-color: #ffffff;
    --surface-hover: #f5f5f7;
    --border-color: #e5e5ea;
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --accent-color: #000000;
    --accent-hover: #333333;
    --danger-color: #ff3b30;
    --success-color: #34c759;
    --sidebar-bg: #f5f5f7;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --skeleton-base: #ebebeb;
    --skeleton-highlight: #fafafa;
    --modal-overlay: rgba(0, 0, 0, 0.4);
    --gradient-start: #000000;
    --gradient-end: #555555;
}

/* Ocean Glass Theme */
body[data-theme="ocean"] {
    --bg-color: #0f172a;
    --surface-color: rgba(15, 23, 42, 0.8);
    --surface-hover: rgba(30, 41, 59, 0.9);
    --border-color: rgba(14, 165, 233, 0.3);
    --text-primary: #f0f9ff;
    --text-secondary: #bae6fd;
    --accent-color: #0ea5e9;
    --accent-hover: #38bdf8;
    --danger-color: #fb7185;
    --success-color: #34d399;
    --sidebar-bg: rgba(15, 23, 42, 0.9);
    --shadow: 0 10px 40px rgba(2, 132, 199, 0.2);
    --glass-bg: rgba(15, 23, 42, 0.7);
    --skeleton-base: #1e293b;
    --skeleton-highlight: #334155;
    --modal-overlay: rgba(2, 6, 23, 0.8);
    --gradient-start: #0ea5e9;
    --gradient-end: #10b981;
}

/* ASG Craft (Крафтовая) */
body[data-theme="asg-craft"] {
    --bg-color: #ebdcci;
    --surface-color: rgba(245, 233, 220, 0.85);
    --surface-hover: rgba(250, 242, 230, 0.95);
    --border-color: rgba(139, 90, 43, 0.25);
    --text-primary: #3d2b1f;
    --text-secondary: #705a4d;
    --accent-color: #b5651d;
    /* Rich caramel / leather */
    --accent-hover: #8b4513;
    /* Saddle brown */
    --danger-color: #8b0000;
    --success-color: #2e8b57;
    --sidebar-bg: rgba(235, 220, 204, 0.9);
    --shadow: 0 10px 40px rgba(92, 58, 33, 0.15);
    --glass-bg: rgba(245, 233, 220, 0.75);
    --skeleton-base: #dfcabc;
    --skeleton-highlight: #eedacb;
    --modal-overlay: rgba(61, 43, 31, 0.6);
    --gradient-start: #b5651d;
    --gradient-end: #8b4513;
}

/* ASG Nature (Природные тона - Темная) */
body[data-theme="asg-nature"] {
    --bg-color: #1a2421;
    /* Dark forest / deep jade background */
    --surface-color: rgba(30, 43, 39, 0.85);
    --surface-hover: rgba(40, 56, 51, 0.95);
    --border-color: rgba(142, 166, 151, 0.15);
    --text-primary: #e6eee8;
    --text-secondary: #9cb5a8;
    --accent-color: #d17a41;
    /* Deep Terracotta / clay accent */
    --accent-hover: #b86935;
    --danger-color: #e55039;
    --success-color: #78e08f;
    --sidebar-bg: rgba(20, 31, 28, 0.9);
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    --glass-bg: rgba(30, 43, 39, 0.7);
    --skeleton-base: #2a3b36;
    --skeleton-highlight: #3b524b;
    --modal-overlay: rgba(8, 13, 11, 0.8);
    --gradient-start: #d17a41;
    --gradient-end: #e5aaa1;
}

/* Archive ASG (Тайный Архив) */
body[data-theme="archive-asg"] {
    --bg-color: #0a0a0a;
    --surface-color: rgba(20, 20, 20, 0.85);
    --surface-hover: rgba(30, 30, 30, 0.95);
    --border-color: rgba(160, 140, 120, 0.12);
    --text-primary: #dcd3c6;
    --text-secondary: #8c8275;
    --accent-color: #8a1c1c;
    --accent-hover: #a82626;
    --danger-color: #e63946;
    --success-color: #2a7251;
    --sidebar-bg: rgba(10, 10, 10, 0.95);
    --shadow: 0 15px 45px rgba(0, 0, 0, 0.8);
    --glass-bg: rgba(20, 20, 20, 0.7);
    --skeleton-base: #1a1a1a;
    --skeleton-highlight: #2a2a2a;
    --modal-overlay: rgba(0, 0, 0, 0.85);
    --gradient-start: #8a1c1c;
    --gradient-end: #1a1a1a;
}

/* Sakura ASG (Сакура Аниме) */
body[data-theme="sakura-asg"] {
    --bg-color: #fff0f5;
    --surface-color: rgba(255, 255, 255, 0.85);
    --surface-hover: rgba(255, 255, 255, 1);
    --border-color: rgba(255, 183, 197, 0.5);
    --text-primary: #5c3a4f;
    --text-secondary: #9e7a8f;
    --accent-color: #ff8eaa;
    --accent-hover: #ff6b90;
    --danger-color: #ff4d6d;
    --success-color: #7bc0a3;
    --sidebar-bg: rgba(255, 240, 245, 0.95);
    --shadow: 0 10px 40px rgba(255, 183, 197, 0.25);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --skeleton-base: #ffe4e1;
    --skeleton-highlight: #fff0f5;
    --modal-overlay: rgba(255, 183, 197, 0.5);
    --gradient-start: #ffb7c5;
    --gradient-end: #ff8eaa;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    transition: background-color 0.4s ease, color 0.4s ease;
    position: relative;
    z-index: 0;

    /* Mobile Touch Optimizations */
    -webkit-tap-highlight-color: transparent;
}

/* Elegant Animated Planet Logo */
.elegant-planet-logo {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.elegant-planet-logo .planet {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-light, #a78bfa), var(--accent-color));
    box-shadow: 0 0 15px var(--accent-color), inset -3px -3px 6px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 2;
    animation: planetBreathe 4s infinite alternate ease-in-out;
}

.elegant-planet-logo .ring {
    position: absolute;
    width: 28px;
    height: 8px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    transform: rotate(-20deg);
    z-index: 1;
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.2), inset 0 0 5px rgba(255, 255, 255, 0.2);
    animation: ringTilt 8s infinite alternate ease-in-out;
}

.elegant-planet-logo .orbit {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    animation: orbitSpin 6s linear infinite;
    z-index: 3;
}

.elegant-planet-logo .moon {
    position: absolute;
    top: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 8px #fff;
}

@keyframes planetBreathe {
    0% {
        transform: scale(1);
        box-shadow: 0 0 10px var(--accent-color), inset -3px -3px 6px rgba(0, 0, 0, 0.4);
    }

    100% {
        transform: scale(1.05);
        box-shadow: 0 0 20px var(--accent-color), inset -3px -3px 6px rgba(0, 0, 0, 0.4);
    }
}

@keyframes ringTilt {
    0% {
        transform: rotate(-20deg) scaleX(1);
    }

    100% {
        transform: rotate(-10deg) scaleX(1.1);
    }
}

@keyframes orbitSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Animated Background (Removed for stability) */

/* Global Typography */
.gradient-text {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

body[data-theme="cyberpunk"] .gradient-text {
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body[data-theme="minimalist"] .gradient-text {
    background: none;
    -webkit-text-fill-color: initial;
    color: var(--text-primary);
}

h1 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0 0 0.5rem 0;
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    line-height: 1;
    /* Match line height for better icon alignment */
}

h2 i {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(1px);
    /* Optical baseline adjustment */
    line-height: 1;
}

.help-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.success-text {
    color: var(--success-color);
    font-size: 1.2rem;
}

.danger-text {
    color: var(--danger-color);
    font-size: 1.2rem;
}

.divider {
    border: 0;
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
}

/* Layout Structure */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Sidebar as Drawer */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sidebar {
    position: fixed;
    left: -320px;
    top: 0;
    bottom: 0;
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    height: 100%;

    /* Hardware Acceleration */
    will-change: transform;
    transform: translateZ(0);
}

.sidebar.open {
    transform: translateX(320px);
    /* Slide in */
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1.5rem 1.5rem 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    text-decoration: none;
    cursor: default;
}

.logo-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--accent-color) 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 8px rgba(139, 92, 246, 0.5));
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.1);
}

.side-nav {
    flex: 1;
    padding: 1.5rem 1rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    margin: 1rem 0 0.5rem 0.5rem;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
    font-family: inherit;

    /* Touch Target */
    min-height: 44px;
}

.nav-btn:hover {
    background-color: var(--surface-hover);
    color: var(--text-primary);
}

.nav-btn.active {
    background-color: var(--accent-color);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 20px -5px var(--accent-color);
}

.nav-btn.active i {
    color: white;
}

.nav-btn i {
    font-size: 1.2rem;
}

/* Sidebar Footer User Info */
.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.user-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-details .name {
    font-weight: 600;
    font-size: 0.95rem;
}

.user-details .role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-height: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.1);
}

.top-bar {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    background-color: transparent;
    /* Changed from glass-bg to match the global blur */
    z-index: 10;
}

.top-bar-title {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.content-container {
    flex: 1;
    padding: 1.5rem 2rem 2.5rem;
    /* Standardized padding */
    overflow-y: auto;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Views & Animation */
.view {
    display: none;
    width: 100%;
    animation: slideFadeUp 0.4s ease forwards;
    max-width: 1200px;
    margin: 0 auto;
    pointer-events: none;
}

.view.active {
    display: block;
    /* Flex causes children to stretch if not careful, reverting to block */
    pointer-events: auto;
}

@keyframes slideFadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 2.5rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-top: 0.5rem;
}

/* Reusable Cards */
.card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.05);
    /* Premium shadow */
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    /* Glassmorphism inner glow */
    pointer-events: none;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 4px 6px rgba(0, 0, 0, 0.05);
}

.card-max {
    max-width: 700px;
}

/* Accordions for Cards */
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.accordion-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.accordion-header:hover {
    color: var(--accent-light);
}

.accordion-icon {
    font-size: 1.5rem;
    color: var(--text-secondary);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Shop List Interactive Item */
.shop-list-item {
    display: flex;
    align-items: center;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    gap: 1.5rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.shop-list-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.shop-list-image {
    width: 80px;
    height: 80px;
    border-radius: 0.75rem;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.shop-list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-list-info {
    flex: 1;
    overflow: hidden;
}

.shop-list-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.shop-list-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shop-list-arrow {
    font-size: 1.5rem;
    color: var(--text-secondary);
    opacity: 0.5;
    transition: all 0.3s ease;
}

.shop-list-item:hover .shop-list-arrow {
    opacity: 1;
    transform: translateX(5px);
    color: var(--accent-color);
}

.card.open > .accordion-header .accordion-icon,
.accordion.open > .accordion-header .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0;
}

.card.open > .accordion-content,
.accordion.open > .accordion-content {
    max-height: 25000px;
    /* Large enough to hold content */
    opacity: 1;
    margin-top: 1.5rem;
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.product-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    overflow: hidden;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

body[data-theme="minimalist"] .product-image {
    background: #f5f5f7;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-info {
    padding: 1.5rem;
}

.product-title {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* ==============================================================
   Compact Product Grid Modifier (Mobile/Tablet)
   ============================================================== */
@media (max-width: 768px) {
    .grid-products-mobile {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.25rem !important; /* Compact gap */
    }
    .grid-products-mobile .product-card {
        padding: 0.25rem !important;
        border-radius: 0.5rem;
        background: var(--surface-color);
    }
    .grid-products-mobile .product-info {
        padding: 0.25rem 0.15rem !important;
        align-items: center; 
        text-align: center;
    }
    .grid-products-mobile .product-image {
        height: 70px !important;
        background: rgba(0, 0, 0, 0.05); /* Slight tint to see bounds */
        border-radius: 0.5rem;
    }
    .grid-products-mobile .placeholder i {
        font-size: 1.5rem !important;
    }
    .grid-products-mobile .product-title {
        font-size: 0.6rem;
        line-height: 1.1;
        margin: 0.2rem 0;
        white-space: normal !important; /* Let title wrap to 2 lines */
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        width: 100%;
        min-height: 1.35rem; /* Symmetry fix: constant height for 1 or 2 lines */
    }
    .grid-products-mobile .product-price {
        font-size: 0.65rem !important;
        margin-top: 0.2rem;
        white-space: nowrap !important;
    }
    .grid-products-mobile .product-info > div { 
        font-size: 0.55rem !important; 
        margin-top: 0.1rem !important; 
        justify-content: center;
        white-space: nowrap !important;
    }
    .grid-products-mobile .ri-box-3-line { 
        display: inline-block !important; 
        font-size: 0.6rem !important; 
        margin-right: 2px !important; 
    }
}

/* Skeleton Loading Animations */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    animation: shimmer 2s infinite linear;
    background: linear-gradient(to right, var(--skeleton-base) 4%, var(--skeleton-highlight) 25%, var(--skeleton-base) 36%);
    background-size: 1000px 100%;
}

.skeleton-text {
    height: 1.2rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 1;
}

.skeleton-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    overflow: hidden;
    backdrop-filter: blur(10px);
}


/* Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-secondary);
}

.empty-state.hidden {
    display: none;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    opacity: 0.5;
}

/* Forms */
.standard-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.standard-form input[type="text"],
.standard-form input[type="number"],
.standard-form input[type="url"],
.standard-form input[type="tel"],
.standard-form input[type="password"],
.styled-select,
.standard-form textarea {
    width: 100%;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.standard-form input:focus,
.styled-select:focus,
.standard-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.standard-form input[type="password"] {
    font-family: monospace, sans-serif;
    letter-spacing: 0.2rem;
    font-size: 1.2rem;
}

.standard-form input[type="password"]::placeholder {
    font-family: 'Inter', -apple-system, sans-serif;
    letter-spacing: normal;
    font-size: 1rem;
}

.file-input {
    padding: 0.6rem !important;
}

.radio-toggle {
    display: flex;
    gap: 1.5rem;
    color: var(--text-primary);
}

.radio-toggle label {
    font-size: 0.95rem;
    cursor: pointer;
}

.radio-toggle input {
    margin-right: 0.4rem;
    cursor: pointer;
}

.submit-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(var(--accent-color-rgb, 139, 92, 246), 0.3);
}

.submit-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--accent-color-rgb, 139, 92, 246), 0.5);
}

.submit-btn:active {
    transform: translateY(1px) scale(0.98);
}

/* Action buttons inside forms/tables */
.action-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.action-btn:active {
    transform: translateY(1px) scale(0.95);
}

/* Themes Grid */
.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.theme-card {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-card:hover {
    transform: translateY(-4px);
}

/* Photo Upload UI */
.photo-upload-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 0.5rem;
}

.photo-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.photo-preview-item {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.3s ease;
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.delete-photo-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}

.delete-photo-btn:hover {
    background: #ef4444;
}

.add-photo-btn {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.5rem;
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
}

.add-photo-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
}

.add-photo-btn.uploading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.add-photo-btn.uploading::before {
    content: "⏳";
    position: absolute;
    z-index: 3;
    font-size: 1rem;
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
    }

    100% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.theme-card.active {
    border-color: var(--accent-color);
    box-shadow: var(--shadow);
}

.theme-preview {
    height: 120px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-accent {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-info {
    padding: 1.25rem;
}

.theme-info h3 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.theme-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Permissions List */
.permissions-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.permissions-list li {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.permissions-list li i {
    margin-top: 0.1rem;
}

/* Profile View */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 2rem;
}

/* Image Preview in Feedback */
.image-preview-container {
    position: relative;
    max-width: 200px;
    border-radius: 0.5rem;
    overflow: hidden;
    margin-top: 1rem;
}

.image-preview-container img {
    width: 100%;
    height: auto;
    display: block;
}

#remove-feedback-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
}

.image-preview-container.hidden {
    display: none;
}


/* Mobile Menu Toggle */
.menu-toggle-btn {
    cursor: pointer;
    color: var(--text-primary);
    margin-right: 1rem;
    display: block;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
    position: relative;
    z-index: 1000;
}

.menu-toggle-btn:hover {
    background: var(--surface-hover);
}

@media (max-width: 800px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 80%;
        /* Takes more screen space on mobile */
        left: -100%;
        /* Fully off-screen */
    }

    .sidebar.open {
        transform: translateX(125%);
        /* Adjust slide-in distance */
    }

    .content-container {
        padding: 1.5rem;
    }

    .top-bar-title {
        display: none;
    }
}

/* ==============================================================
   Modal Global Styles
   ============================================================== */
.modal {
    position: fixed;
    inset: 0;
    background: var(--modal-overlay, rgba(0, 0, 0, 0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    opacity: 1;
    visibility: visible;
    transition: all 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: 1.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border-color);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.modal.hidden .modal-content {
    transform: scale(0.95) translateY(20px);
}

/* Glassmorphism exception for modals */
body[data-theme="asg-glass"] .modal-content,
body[data-theme="ocean"] .modal-content {
    background: var(--surface-color);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: var(--shadow);
}

/* Fix visibility for Craft theme */
body[data-theme="asg-craft"] .modal-content {
    background: var(--surface-color);
    box-shadow: 0 25px 50px -12px rgba(61, 43, 31, 0.4);
}

/* ==============================================================
   Compact Grid & Product Carousel Modal Styles
   ============================================================== */

.compact-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 1rem !important;
}

.compact-grid .product-info {
    padding: 0.75rem !important;
}

.compact-grid .product-title {
    font-size: 0.95rem !important;
    margin-bottom: 0.25rem !important;
}

.compact-grid .product-price {
    font-size: 1.05rem !important;
}

/* Premium Product Modal */
.product-modal-content {
    background: var(--bg-color) !important;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

body[data-theme="asg-glass"] .product-modal-content,
body[data-theme="ocean"] .product-modal-content {
    background: var(--surface-color) !important;
}

.product-carousel {
    position: relative;
    width: 100%;
    height: 350px;
    background: rgba(0,0,0,0.1);
}

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 5;
}

.carousel-indicators .dot {
    transition: width 0.3s ease, background 0.3s ease;
}

.carousel-indicators .dot.active {
    width: 16px !important;
    border-radius: 4px !important;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.3s ease;
}

.carousel-btn:hover {
    background: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}

.prev-btn {
    left: 10px;
}

.next-btn {
    right: 10px;
}

.product-modal-info {
    padding: 1.5rem;
}

.pm-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
}

.pm-qty-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background: #ef4444;
    transform: scale(1.1);
}

from {
    opacity: 0;
    transform: scale(0.98);
}

to {
    opacity: 1;
    transform: scale(1);
    background: var(--surface-color);
    padding: 0.8rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.cart-item-info {
    flex: 1;
}

.cart-item-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 0.2rem;
}

.cart-item-price {
    font-size: 0.9rem;
    color: var(--accent-color);
}

.cart-quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.3rem;
    border-radius: 20px;
}

.cart-qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.cart-qty-btn:hover {
    background: var(--accent-light);
    color: white;
}

.cart-item-remove {
    color: #ef4444;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.1);
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item-remove:hover {
    background: #ef4444;
    color: white;
}

/* Floating Cart Button Re-positioned */
.floating-btn {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    min-width: 140px;
    height: 56px;
    border-radius: 28px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.2);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* Initial state for hidden elements */
    padding: 0 1.5rem;
}

/* ==============================================================
   Mobile Optimization
   ============================================================== */
@media (max-width: 800px) {
    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 80%;
        left: -100%;
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(125%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .content-container {
        padding: 1.5rem;
    }

    .top-bar-title {
        display: none;
    }

    .compact-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
        gap: 0.75rem !important;
    }
}

/* Enhanced Search & Filter Bar */
.search-filter-bar {
    display: flex; gap: 1rem; margin-bottom: 0.5rem; position: sticky; top: 0; z-index: 10;
    background: var(--bg-color);
    background: color-mix(in srgb, var(--surface-color) 80%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 0.75rem 1rem; border-radius: 1rem; align-items: center;
    border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.search-input-wrapper {
    flex: 1; position: relative;
}

.search-icon {
    position: absolute; left: 1.2rem; top: 50%; transform: translateY(-50%); color: var(--accent-color); font-size: 1.2rem;
}

#store-search-input {
    width: 100%; padding: 0.75rem 1rem 0.75rem 3.2rem; border-radius: 0.8rem;
    border: 1px solid var(--border-color); background: var(--surface-color); color: var(--text-primary);
    font-size: 0.95rem; outline: none; transition: all 0.3s ease;
}

.sort-wrapper {
    min-width: 180px; position: relative;
}

.sort-icon-btn {
    display: none;
}

.sort-select {
    width: 100%; padding: 0.9rem 1rem; border-radius: 0.8rem; border: 1px solid var(--border-color);
    background: var(--surface-color); color: var(--text-primary); outline: none; transition: all 0.3s ease;
    cursor: pointer; appearance: none; -webkit-appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23888888" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>');
    background-repeat: no-repeat; background-position-x: 95%; background-position-y: 50%;
}
.sort-select option {
    background: var(--bg-color);
    color: var(--text-primary);
}

@media (max-width: 480px) {
    .search-filter-bar {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    .sort-wrapper {
        min-width: auto;
    }
    .sort-icon-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 45px;
        height: 45px;
        border-radius: 0.8rem;
        background: var(--surface-color);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        font-size: 1.4rem;
        pointer-events: none;
    }
    .sort-select {
        position: absolute;
        top: 0; left: 0; width: 100%; height: 100%;
        opacity: 0;
        cursor: pointer;
    }
    .content-container {
        padding: 1rem;
    }

    .grid-split {
        grid-template-columns: 1fr !important;
    }

    .card {
        padding: 1.25rem;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    /* Custom Mobile Grids */
    .grid-shops-mobile {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .grid-categories-mobile {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.4rem !important;
    }
    .grid-categories-mobile .product-card {
        padding: 0.25rem;
    }
    .grid-categories-mobile .product-info {
        padding: 0.25rem !important;
    }
    .grid-categories-mobile i[class^="ri-"] {
        font-size: 1.5rem !important;
        margin-bottom: 0.25rem !important;
    }
    .grid-categories-mobile .product-title {
        font-size: 0.65rem;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
        margin: 0;
    }
    .grid-categories-mobile .help-text { display: none; }
    .grid-categories-mobile .product-image { height: 40px !important; }

    .modal-content {
        padding: 1.25rem;
        margin: 1rem;
        width: auto;
        max-height: 88vh;
    }

    .product-modal-content {
        padding: 0 !important;
        overflow: hidden;
    }

    .product-modal-info {
        padding: 1rem;
    }

    .product-carousel {
        height: 250px;
    }

    .radio-toggle {
        flex-direction: column;
        gap: 0.75rem;
    }

    .nav-btn,
    .action-btn,
    .submit-btn {
        min-height: 48px;
        /* Larger touch targets */
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.15rem;
    }

    .floating-btn {
        bottom: 1rem;
        width: calc(100% - 2rem);
        left: 1rem;
        transform: none;
    }

    .shop-list-item {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }

    .shop-list-image {
        width: 100%;
        height: 140px;
    }

    .shop-list-arrow {
        display: none;
    }

    .table-container {
        width: 100%;
        overflow-x: auto;
    }

    table {
        white-space: nowrap;
    }
}


.floating-btn.hidden {
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, 20px) scale(0.9);
    pointer-events: none;
}

.floating-btn:hover {
    transform: translateX(-50%) translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    filter: brightness(1.1);
}

.floating-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.floating-btn i {
    font-size: 1.4rem;
}

#cart-badge {
    position: static;
    background: #ef4444;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    min-width: 24px;
    height: 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    margin-left: 0.5rem;
}

/* Pulsing animation for cart when items exist */
@keyframes pulseCart {
    0% {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(139, 92, 246, 0.4);
    }

    70% {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 0 15px rgba(139, 92, 246, 0);
    }

    100% {
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(139, 92, 246, 0);
    }
}

.floating-btn.has-items {
    animation: pulseCart 2s infinite;
}

/* New Elegant Celestial/Saturn Logo Animations */
.celestial-logo {
    color: var(--accent-light, #a78bfa);
    filter: drop-shadow(0 0 8px var(--accent-color));
    animation: celestialFloat 6s ease-in-out infinite;
    transform-origin: center;
}

.celestial-logo ellipse {
    animation: ringGlow 4s ease-in-out infinite alternate;
}

.orbiting-star {
    transform-origin: 50px 50px;
    animation: orbit 10s linear infinite;
}

.orbiting-star-alt {
    transform-origin: 50px 50px;
    animation: orbitAlt 15s linear infinite;
}

@keyframes celestialFloat {

    0%,
    100% {
        transform: translateY(0) rotate(0deg) scale(1);
    }

    50% {
        transform: translateY(-3px) rotate(2deg) scale(1.05);
        filter: drop-shadow(0 0 12px var(--accent-color));
    }
}

@keyframes ringGlow {
    from {
        color: rgba(255, 255, 255, 0.4);
    }

    to {
        color: rgba(255, 255, 255, 0.9);
        filter: drop-shadow(0 0 5px white);
    }
}

@keyframes orbit {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@keyframes orbitAlt {
    from {
        transform: rotate(360deg);
    }

    to {
        transform: rotate(0deg);
    }
}

.action-btn {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.list-row:last-child {
    border-bottom: none;
}

/* High-Contrast Snackbars/Toasts */
.alert-overlay {
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
    height: auto;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 99999;
    pointer-events: none;
}

.alert {
    background: #222222; /* Solid dark background for contrast */
    color: #ffffff; /* Explicit white text */
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 90vw;
    width: auto;
    min-width: 280px;
    pointer-events: auto;
}

.alert.success {
    border-left: 4px solid #34d399; /* Emerald */
}

.alert.error {
    border-left: 4px solid #f87171; /* Red */
}

.alert.info {
    border-left: 4px solid #60a5fa; /* Blue */
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    color: #ffffff; /* Override transparent themes */
}

.alert-content i {
    font-size: 1.4rem;
}

.alert.success i { color: #34d399; }
.alert.error i { color: #f87171; }
.alert.info i { color: #60a5fa; }

.alert-close-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
    margin-left: auto;
}

.alert-close-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #ffffff;
}

@keyframes dropIn {
    0% {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==============================================================
   Search & Filter Bar Styles
   ============================================================== */
.search-filter-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.2rem;
    pointer-events: none;
}

#store-search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 1rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
}

#store-search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px rgba(var(--accent-color-rgb, 139, 92, 246), 0.15);
}

.sort-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.sort-wrapper .sort-icon-btn {
    display: none; /* Desktop uses the visible select box */
}

/* Base Sort Select for Desktop */
.sort-select {
    padding: 1rem 1.5rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    border-radius: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 3rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24' fill='%23666'%3E%3Cpath d='M12 16L6 10H18L12 16Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

.sort-select:hover, .sort-select:focus {
    border-color: var(--accent-color);
    outline: none;
}

@media (max-width: 768px) {
    .search-filter-bar {
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }
    
    #store-search-input {
        padding: 0.8rem 0.8rem 0.8rem 2.5rem;
        font-size: 0.95rem;
    }
    
    .search-input-wrapper .search-icon {
        left: 0.8rem;
    }

    /* Transform Sort Dropdown into a compact square icon button overlay on Mobile */
    .sort-wrapper {
        width: 44px;
        height: 44px;
        background: var(--surface-color);
        border: 1px solid var(--border-color);
        border-radius: 0.75rem;
        display: flex;
        justify-content: center;
        align-items: center;
        flex-shrink: 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .sort-wrapper .sort-icon-btn {
        display: block;
        color: var(--text-primary);
        font-size: 1.2rem;
    }

    .sort-select {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        opacity: 0;
        cursor: pointer;
        padding: 0;
    }
}

/* --- MOBILE PERFORMANCE OPTIMIZATIONS --- */
@media (max-width: 768px) {

    /* Hardware acceleration for scroll containers */
    .content-container,
    .side-nav {
        -webkit-overflow-scrolling: touch;
        will-change: scroll-position;
    }

    /* Prevent overscroll bounce (rubber-banding) for app-like feel */
    body,
    .app-layout {
        overscroll-behavior-y: none;
    }

    /* Simplify expensive shadows on cards to boost FPS */
    .card {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    }

    /* Remove sticky hover transformations on touch devices */
    @media (hover: none) {

        .card:hover,
        .nav-btn:hover,
        .submit-btn:hover,
        .cart-qty-btn:hover {
            transform: none !important;
        }
    }

    /* Promote heavy animating elements to their own composite layer (GPU Acceleration) */
    .view,
    .modal-content,
    .logo svg,
    .floating-btn {
        will-change: transform, opacity;
        transform: translateZ(0);
    }

    /* Ensure comfortable touch targets */
    .nav-btn,
    .submit-btn,
    .cart-qty-btn,
    select,
    input {
        min-height: 44px;
    }

    /* Shrink the carousel height on mobile to prevent overflow/overlap issues on very tiny screens */
    .product-carousel {
        height: 250px;
        overflow: hidden;
    }

    /* Requested Grid Fixes to shrink icons tightly */
    .grid-shops-mobile {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem !important;
    }

    .grid-categories-mobile {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.5rem !important;
    }

    .grid-categories-mobile .category-card-inner {
        padding: 0.5rem !important;
    }

    .grid-categories-mobile .category-image {
        border-radius: 0.5rem;
    }

    .grid-categories-mobile .category-title {
        font-size: 0.7rem;
        margin-top: 0.25rem !important;
    }

    .grid-categories-mobile .category-count-badge {
        display: none !important;
    }

}

/* ==============================================================
   Smart Tags & Refactored Mobile Search Bar
   ============================================================== */
.smart-tags-container {
    margin: 0 -1.5rem 1rem -1.5rem;
    padding: 0 1.5rem;
    overflow: hidden;
    position: relative;
}

.smart-tags-scroll {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.25rem;
}

.smart-tags-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.smart-tag {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.smart-tag:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.smart-tag.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Ensure search bar adapts to the theme instead of staying globally dark */
.search-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 0.4rem 0.6rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.search-filter-bar:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(var(--accent-color-rgb, 124, 58, 237), 0.2);
}

.search-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 0.5rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    pointer-events: none;
}

.search-input-wrapper input {
    width: 100%;
    background: transparent !important;
    border: none !important;
    padding: 0.5rem 0.5rem 0.5rem 2rem !important;
    color: var(--text-primary) !important;
    font-size: 0.95rem;
    outline: none;
}

.search-input-wrapper input::placeholder {
    color: var(--text-secondary);
}

.sort-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 0.5rem;
    border-left: 1px solid var(--border-color);
}

.sort-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    padding: 0.4rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.sort-icon-btn:hover {
    background: var(--surface-hover);
}

.sort-select-hidden {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 10;
    background: transparent;
    color: var(--text-primary);
}

.sort-select-hidden option {
    background: var(--surface-color);
    color: var(--text-primary);
}

@media (max-width: 600px) {
    .smart-tags-container {
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Category Toggle Icon Animation for Manager View */
details[open] > summary .cat-toggle-icon {
    transform: rotate(90deg);
}

/* ==============================================================
   Store/Shop List UI 
   ============================================================== */
.shops-list {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem;
    padding: 0.5rem 0;
}

@media (max-width: 600px) {
    .shops-list {
        grid-template-columns: 1fr !important; /* Stack vertically on very small screens, or we can keep it 2 columns and scroll */
    }
}

.shop-list-item {
    display: flex;
    flex-direction: row;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
    height: 120px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
    cursor: pointer;
}

.shop-list-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: var(--accent-light);
}

/* Left side (less than half for photo) */
.shop-list-image {
    width: 35%;
    height: 100%;
    background: color-mix(in srgb, var(--accent-color) 5%, var(--bg-color));
    display: flex;
    align-items: center;
    justify-content: center;
    border-right: 1px solid var(--border-color);
    position: relative;
}

.shop-list-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-list-image.placeholder i {
    color: var(--accent-color);
    opacity: 0.6;
}

/* Right side (larger part for title and description) */
.shop-list-info {
    width: 65%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.shop-list-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.2;
}

.shop-list-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.shop-list-arrow {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.5rem;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
}

.shop-list-item:hover .shop-list-arrow {
    opacity: 1;
    color: var(--accent-color);
    transform: translate(3px, -50%);
}

/* ==============================================================
   Categories Compact Grid (2 Columns, Larger Icons)
   ============================================================== */
.categories-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

@media (max-width: 380px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

.category-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 0.5rem;
    text-align: center;
    gap: 0.8rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
    height: 140px; /* Force height so 4 items fit nicely on typical mobile screens */
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.06);
    border-color: var(--accent-light);
}

.category-card-icon {
    width: 60px;
    height: 60px;
    background: color-mix(in srgb, var(--accent-color) 10%, var(--surface-color));
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--accent-color);
}

.category-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.category-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    padding: 0 0.4rem;
}