:root {
            --brand-primary: #1d1c1c; /* Sky 500 */
            --brand-secondary: #1d1c1c; /* Sky 600 */
            --brand-gradient-start: #1d1c1c;
            --brand-gradient-end: #1d1c1c;
            --brand-bg: #f0f9ff; /* Sky 50 */
        }

        body { 
            font-family: 'Cairo', sans-serif; 
            background: var(--brand-bg); 
            min-height: 100vh;
            -webkit-tap-highlight-color: transparent;
            /* padding-top is handled dynamically now */
            color: #334155;
        }
        
        body.app-active {
            padding-top: 130px; 
        }
        body.app-active.filters-visible {
            padding-top: 260px;
        }
        
        #branch-selection-screen {
            position: fixed;
            inset: 0;
            z-index: 200;
            background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 20px;
            transition: transform 0.4s ease-in-out, opacity 0.4s ease-in-out;
        }
        #branch-selection-screen.hidden-screen {
            transform: translateY(-100%);
            opacity: 0;
            pointer-events: none;
        }

        .branch-card {
            background: white;
            border-radius: 24px;
            padding: 20px;
            width: 100%;
            max-width: 320px;
            margin-bottom: 20px;
            box-shadow: 0 10px 30px rgba(14, 165, 233, 0.15);
            border: 1px solid rgba(255,255,255,0.8);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            position: relative;
            overflow: hidden;
        }
        .branch-card:active { transform: scale(0.96); }
        .branch-card:hover { transform: translateY(-5px); box-shadow: 0 15px 40px rgba(14, 165, 233, 0.25); border-color: var(--brand-primary); }
        
        .branch-icon-container {
            width: 80px;
            height: 80px;
            background: #f0f9ff;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: 15px;
            color: var(--brand-primary);
            transition: all 0.3s ease;
        }
        .branch-card:hover .branch-icon-container { background: var(--brand-primary); color: white; }

        .main-header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 50;
            background: linear-gradient(135deg, var(--brand-gradient-start) 0%, var(--brand-gradient-end) 100%);
            box-shadow: 0 4px 20px rgba(14, 165, 233, 0.2);
            border-bottom-left-radius: 24px;
            border-bottom-right-radius: 24px;
            overflow: hidden; 
            padding-bottom: 12px;
            transition: all 0.3s ease;
        }

        .header-input {
            background: rgba(255, 255, 255, 0.15);
            border: 1px solid rgba(255, 255, 255, 0.25);
            color: white;
            backdrop-filter: blur(8px);
        }
        .header-input::placeholder { color: rgba(255, 255, 255, 0.85); }
        .header-input:focus { background: rgba(255, 255, 255, 0.25); outline: none; }
        
        .input-filter-btn {
            position: absolute;
            left: 4px;
            top: 50%;
            transform: translateY(-50%);
            padding: 4px 8px;
            border-radius: 8px;
            color: rgba(255,255,255,0.95);
            background: rgba(255,255,255,0.2);
            border: 1px solid rgba(255,255,255,0.3);
            transition: all 0.2s;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            font-size: 10px;
            font-weight: 700;
        }
        .input-filter-btn:hover { background: rgba(255,255,255,0.3); color: white; }
        .input-filter-btn.active {
            color: var(--brand-primary);
            background: #ffffff;
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        }

        /* Modern Size Modal */
        .modern-modal-content {
            background: white;
            width: 100%;
            max-width: 400px;
            border-radius: 24px;
            box-shadow: 0 10px 40px rgba(0,0,0,0.15);
            overflow: hidden;
            animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        }
        @keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
        
        .size-section-header {
            background: #f1f5f9;
            padding: 8px 16px;
            font-size: 12px;
            font-weight: 800;
            color: #475569;
            border-bottom: 1px solid #e2e8f0;
            margin-bottom: 8px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .size-chips-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            padding: 0 16px 16px 16px;
        }
        .size-chip {
            padding: 8px 16px;
            border-radius: 12px;
            background: white;
            border: 1px solid #cbd5e1;
            color: #475569;
            font-weight: 700;
            font-size: 13px;
            cursor: pointer;
            transition: all 0.2s;
            box-shadow: 0 1px 2px rgba(0,0,0,0.03);
            flex: 1 0 auto;
            text-align: center;
            min-width: 50px;
        }
        .size-chip:active { transform: scale(0.95); }
        .size-chip.active {
            background: var(--brand-primary);
            color: white;
            border-color: var(--brand-primary);
            box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
        }

        /* Store Card Design */
        .store-card {
            background: white;
            border-radius: 16px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            overflow: hidden;
            position: relative;
            border: 1px solid #e2e8f0;
        }
        .store-card:active { transform: scale(0.98); }
        
        .img-wrapper {
            aspect-ratio: 1 / 1;
            background: #f8fafc;
            position: relative;
            overflow: hidden;
        }
        .product-img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 0.5s ease;
        }
        
        /* Hover Panel Styles */
        .hover-panel {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: white;
            padding: 15px 10px;
            border-top-left-radius: 25px;
            border-top-right-radius: 25px;
            box-shadow: 0 -5px 25px rgba(0,0,0,0.1);
            transform: translateY(110%);
            transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            z-index: 20;
            display: flex;
            flex-direction: column;
            gap: 10px;
            align-items: center;
            text-align: center;
        }
        .store-card:hover .hover-panel {
            transform: translateY(0);
        }

        .h-color-btn {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            border: 2px solid transparent;
            overflow: hidden;
            cursor: pointer;
            transition: all 0.2s;
            background: #f8fafc;
        }
        .h-color-btn:hover { border-color: #cbd5e1; transform: scale(1.1); }
        .h-color-btn.selected { border-color: var(--brand-primary); }
        .h-color-btn img { 
            width: 100%; 
            height: 100%; 
            object-fit: cover; 
        }

        .h-size-btn {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            border: 1px solid #e2e8f0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
            font-weight: 700;
            color: #64748b;
            background: white;
            cursor: pointer;
            transition: all 0.2s;
        }
        .h-size-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
        .h-size-btn.available { border-color: var(--brand-primary); color: var(--brand-primary); font-weight: 900; }

        /* Modal & Strip Design */
        .modal-overlay { 
            background: rgba(0, 0, 0, 0.6); 
            backdrop-filter: blur(4px);
        }
        
        .variation-strip {
            display: flex;
            gap: 12px;
            overflow-x: auto;
            padding: 8px 4px;
            scroll-behavior: smooth;
            -ms-overflow-style: none;
            scrollbar-width: none;
        }
        .variation-strip::-webkit-scrollbar { display: none; }
        
        .color-thumb {
            min-width: 60px;
            height: 60px;
            border-radius: 50%; 
            border: 3px solid transparent;
            cursor: pointer;
            transition: all 0.3s ease;
            background: #f8fafc;
            overflow: hidden;
            position: relative;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        .color-thumb.active {
            border-color: var(--brand-primary);
            transform: scale(1.1);
            box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
        }
        .color-thumb img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .size-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
            gap: 8px;
            margin-top: 12px;
        }
        .size-btn {
            background: white;
            border: 1px solid #cbd5e1;
            border-radius: 12px;
            padding: 8px;
            text-align: center;
            cursor: pointer;
            transition: all 0.2s;
            position: relative;
            overflow: hidden;
        }
        .size-btn.active {
            background: #f0f9ff;
            border-color: var(--brand-primary);
            color: #0369a1;
            box-shadow: 0 2px 8px rgba(14, 165, 233, 0.2);
        }
        .size-btn.no-stock {
            opacity: 0.5;
            background: #f1f5f9;
            border-style: dashed;
        }
        .stock-badge-corner {
            position: absolute;
            top: 0;
            left: 0;
            background: rgba(0,0,0,0.05);
            padding: 2px 6px;
            border-bottom-right-radius: 8px;
            font-size: 9px;
            font-weight: 700;
            color: #64748b;
        }
        .size-val { font-size: 14px; font-weight: 800; display: block; margin-bottom: 2px; }
        .qty-val { font-size: 10px; font-weight: 700; }
        .text-green-600 { color: #059669; }
        .text-red-500 { color: #ef4444; }

        .stock-tag-pro {
            position: absolute;
            top: 8px;
            left: 8px;
            background: rgba(0,0,0,0.6);
            color: #ffffff;
            padding: 3px 8px;
            border-radius: 8px;
            font-size: 11px;
            font-weight: 700;
            z-index: 10;
            display: flex;
            align-items: center;
            gap: 4px;
            backdrop-filter: blur(2px);
        }
        
        .mobile-sheet-content {
            height: 85vh;
            max-height: 90vh;
        }
        
        .skeleton {
            background: linear-gradient(90deg, #e2e8f0 25%, #cbd5e1 50%, #e2e8f0 75%);
            background-size: 200% 100%;
            animation: shimmer 1.5s infinite;
        }
        @keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
        
        .filter-btn {
            transition: all 0.2s ease;
            font-size: 11px;
            padding: 6px 12px;
            white-space: nowrap;
            display: flex;
            align-items: center;
            gap: 6px;
            border-radius: 10px;
        }
        .filter-btn-inactive {
            background: rgba(255, 255, 255, 0.15);
            color: rgba(255, 255, 255, 0.9);
            border: 1px solid rgba(255, 255, 255, 0.15);
        }
        .filter-btn-active {
            background: white;
            color: var(--brand-primary);
            font-weight: 800;
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }

        .sort-chip {
            padding: 6px 10px;
            border-radius: 8px;
            font-size: 10px;
            font-weight: 700;
            white-space: nowrap;
            display: flex;
            align-items: center;
            gap: 4px;
            transition: all 0.2s;
            cursor: pointer;
            border: 1px solid rgba(255, 255, 255, 0.15);
            background: rgba(255, 255, 255, 0.1);
            color: white;
        }
        .sort-chip.active {
            background: white;
            color: var(--brand-secondary);
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            border-color: white;
        }

        #filters-section {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            opacity: 0;
        }
        #filters-section.visible {
            max-height: 400px;
            opacity: 1;
            margin-top: 8px;
        }

        .modal-image-container {
            height: 280px;
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: #f1f5f9;
        }
        @media (min-width: 768px) { .modal-image-container { height: 100%; } }
        
        .zoom-modal { background: rgba(0, 0, 0, 0.95); backdrop-filter: blur(5px); }
        .zoom-img { max-width: 95%; max-height: 80vh; object-fit: contain; }

        .login-bg { background: linear-gradient(135deg, var(--brand-gradient-start) 0%, var(--brand-gradient-end) 100%); }

        .im-row {
            transition: all 0.2s;
            border-bottom: 1px solid #f1f5f9;
        }
        .im-row:last-child { border-bottom: none; }
        .im-row:hover { background-color: #f8fafc; }
        .im-thumb {
            width: 40px;
            height: 40px;
            border-radius: 8px;
            object-fit: cover;
            background-color: #e2e8f0;
        }
        .upload-btn-label {
            cursor: pointer;
            background: #eff6ff;
            color: #0284c7;
            padding: 6px 12px;
            border-radius: 8px;
            font-size: 11px;
            font-weight: 700;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            transition: all 0.2s;
            border: none; 
        }
        .upload-btn-label:hover {
            background: #e0f2fe;
            color: #0369a1;
        }
        .upload-btn-label.uploaded {
            background: #f0fdf4;
            color: #16a34a;
        }