/* X-MARKET витрина — основное оформление витрины.
   Подключается из shop.html. */

        :root { --purple: #4A2398; --purple-light: #6C3BC4; --green: #00E676; --coral: #FF5252; --blue: #005BFF; --bg: #F4F5F7; --text: #333; --nav-inactive: #9e9e9e; --nav-active: #8e73ba; }
        * { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Montserrat', sans-serif; }
        body { background-color: var(--bg); color: var(--text); padding-bottom: 120px; }
        
        .preloader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--purple); z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 30px; transition: opacity 0.5s ease, visibility 0.5s ease; overflow: hidden; }
        .preloader.hidden { opacity: 0; visibility: hidden; }
        .preloader-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
        .spinner { width: 40px; height: 40px; border: 4px solid rgba(255,255,255,0.5); border-top-color: white; border-radius: 50%; animation: spin 1s linear infinite; position: relative; z-index: 2; }
        @keyframes spin { to { transform: rotate(360deg); } }

        .header-container { position: relative; width: 100%; display: none; }
        .header-container.active { display: block; }
        .header { width: 100%; height: auto; aspect-ratio: 1376 / 768; background-image: url('/header3.jpg?v=4a268cfc'); background-size: cover; background-position: center; border-bottom-left-radius: 25px; border-bottom-right-radius: 25px; }
        
        .promo-button-wrapper { padding: 15px 15px 0 15px; display: none; }
        .promo-button-wrapper.active { display: block; }
        .promo-action-btn { width: 100%; background: linear-gradient(90deg, var(--purple), var(--purple-light)); color: white; border: none; padding: 12px 15px; border-radius: 12px; font-weight: 600; font-size: 12px; display: flex; justify-content: space-between; cursor: pointer; }

        .search-container { padding: 15px; display: none; }
        .search-container.active { display: block; }
        .search-input { width: 100%; padding: 15px; border: none; border-radius: 12px; font-size: 14px; }
        .page-title { padding: 20px 15px 0; font-size: 20px; font-weight: 800; color: var(--purple); display: none; }
        .page-title.active { display: block; }
        
        .catalog { display: none; grid-template-columns: 1fr 1fr; gap: 12px; padding: 15px; margin-top: 15px; }
        .catalog.active { display: grid; }
        
        .card { background: white; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 12px rgba(0,0,0,0.05); display: flex; flex-direction: column; position: relative; }
        .card-image-wrapper { width: 100%; aspect-ratio: 1 / 1; background: #f0f0f0; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; position: relative; }
        .card-img { width: 100%; height: 100%; object-fit: contain; }
        .card-body { padding: 10px; display: flex; flex-direction: column; flex-grow: 1; }
        .card-title { font-size: 12px; font-weight: 600; color: #555; margin-bottom: 3px; cursor: pointer;}
        .card-specs { font-size: 10px; color: #888; margin-bottom: 5px; }
        .card-price { background: linear-gradient(90deg, var(--coral), var(--purple-light)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; font-size: 16px; font-weight: 800; margin-top: auto; margin-bottom: 10px; }
        
        .btn-add { background: var(--bg); border: 1px solid var(--purple); color: var(--purple); border-radius: 8px; padding: 8px; font-weight: 600; font-size: 12px; cursor: pointer; width: 100%; text-align: center; display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 5px; }
        .btn-add:active { background: var(--blue); color: white; }
        .btn-add svg { width: 14px; height: 14px; stroke-width: 2; }
        .btn-stop-active { background-color: #005BFF !important; color: white !important; border-color: #005BFF !important; }
        
        .admin-create-card { background: #fff; border: 2px dashed var(--purple); border-radius: 16px; display: none; flex-direction: column; padding: 10px; gap: 8px; grid-column: 1 / -1; }
        .admin-create-card.show { display: flex; }
        .admin-input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; }
        .admin-textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 8px; height: 60px;}
        .admin-images-grid { display: flex; gap: 5px; overflow-x: auto; padding-bottom: 5px; }
        .admin-img-box { min-width: 60px; height: 60px; background: var(--bg); border-radius: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; position: relative; overflow: hidden; border: 1px solid #ddd; flex-shrink: 0; }
        .admin-img-box img { width: 100%; height: 100%; object-fit: cover; display: none; position: absolute; top: 0; left: 0; }
        .admin-img-box span { font-size: 20px; color: #888; }
        .admin-img-box .main-badge { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.6); color: white; font-size: 8px; text-align: center; display: none; z-index: 2;}
        .admin-img-box.is-main .main-badge { display: block; }
        .btn-del-img { position: absolute; top: 2px; right: 2px; background: rgba(255,0,0,0.8); color: white; border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 10px; cursor: pointer; z-index: 3; }

        .admin-decor-add { display: flex; gap: 5px; margin-bottom: 5px; }
        .admin-decor-add input { flex-grow: 1; padding: 8px; border: 1px solid #ddd; border-radius: 8px; font-size: 12px;}
        .admin-decor-add button { background: var(--purple); color: white; border: none; padding: 0 15px; border-radius: 8px; cursor: pointer; font-weight: 800; }
        .admin-colors-group { display: flex; flex-wrap: wrap; gap: 8px; padding: 5px 0; }
        .admin-color-check { display: flex; align-items: center; gap: 5px; font-size: 12px; background: var(--bg); padding: 4px 8px; border-radius: 20px;}
        .btn-del-decor { background: none; border: none; color: var(--coral); cursor: pointer; font-size: 14px; margin-left: 2px;}
        .btn-admin-save { background: var(--green); color: black; border: none; padding: 12px; border-radius: 8px; font-weight: 800; font-size: 14px; cursor: pointer; }
        
        .fav-wrapper { position: absolute; bottom: 8px; left: 8px; z-index: 10; background: rgba(255, 255, 255, 0.9); border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 2px 5px rgba(0,0,0,0.15); }
        .fav-wrapper svg { width: 18px; height: 18px; stroke-width: 2; color: #ccc; }
        .fav-wrapper.active svg { fill: var(--coral); stroke: var(--coral); }
        
        .bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; background: white; display: flex; justify-content: space-around; align-items: center; padding: 20px; z-index: 100; box-shadow: 0 -4px 20px rgba(0,0,0,0.05); border-top-left-radius: 20px; border-top-right-radius: 20px; }
        .nav-item { display: flex; align-items: center; justify-content: center; color: var(--nav-inactive); cursor: pointer; flex: 1; position: relative; }
        .nav-item svg { width: 24px; height: 24px; stroke-width: 1.5; }
        .nav-item.active { color: var(--nav-active); }
        .nav-item.active svg { stroke-width: 2; }
        .cart-badge { position: absolute; top: -4px; right: 25%; background: var(--coral); color: white; font-size: 10px; font-weight: 800; min-width: 16px; height: 16px; border-radius: 8px; display: flex; align-items: center; justify-content: center; border: 2px solid white; }
        
        .modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 200; display: none; align-items: flex-end; }
        .modal-overlay.active { display: flex; }
        .modal-content { background: white; width: 100%; border-top-left-radius: 25px; border-top-right-radius: 25px; display: flex; flex-direction: column; height: 90%; }
        .modal-header { padding: 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
        .modal-title { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 8px;}
        .modal-title svg { width: 20px; height: 20px; stroke-width: 2;}
        .btn-close { background: none; border: none; font-size: 24px; color: #888; cursor: pointer; }
        .modal-footer { padding: 20px; border-top: 1px solid #eee; display: flex; flex-direction: column; gap: 15px; }
        .modal-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; }
        
        .btn-checkout { background: var(--blue); color: white; border: none; width: 100%; padding: 15px; border-radius: 12px; font-weight: 800; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;}
        .cart-modal .modal-content { height: 90%; }
        .modal-body { padding: 15px; overflow-y: auto; flex-grow: 1; }
        .cart-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; }
        .cart-item-info { display: flex; flex-direction: column; width: 50%; }
        .cart-item-name { font-size: 14px; font-weight: 600; }
        .cart-item-price { font-size: 12px; color: var(--blue); font-weight: 800; margin-top: 5px; }
        .cart-item-controls { display: flex; align-items: center; gap: 15px; background: var(--bg); padding: 5px 10px; border-radius: 20px; }
        .cart-item-controls button { background: none; border: none; font-size: 18px; font-weight: 800; color: var(--blue); cursor: pointer; width: 20px; }
        .cart-item-qty { font-weight: 800; font-size: 14px; }
        .btn-delete-item { background: none; border: none; color: #ff5252; cursor: pointer; margin-left: 10px; }
        .payment-info { font-size: 12px; color: #2e7d32; background: #e8f5e9; padding: 12px; border-radius: 8px; margin-bottom: 15px; border-left: 4px solid var(--green); }
        
        .carousel-container { position: relative; width: 100%; height: 300px; background: #f9f9f9; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
        .carousel-img { min-width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; }
        .product-detail-info { padding: 20px; }
        .product-detail-title { font-size: 20px; font-weight: 800; margin-bottom: 10px; }
        .product-detail-price { font-size: 24px; font-weight: 800; color: var(--blue); margin-bottom: 20px; }
        .product-detail-specs { font-size: 14px; background: var(--bg); padding: 10px; border-radius: 8px; margin-bottom: 15px; font-weight: 600; }
        .product-detail-desc { font-size: 14px; color: #555; line-height: 1.5; margin-bottom: 30px; }
        
        .color-selector { margin-bottom: 20px; }
        .color-label { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: block;}
        .color-options { display: flex; gap: 15px; flex-wrap: wrap; }
        .color-item { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; }
        .color-option { width: 36px; height: 36px; border-radius: 50%; border: 2px solid #ddd; box-shadow: inset 0 0 0 2px white; }
        .color-item.active .color-option { border-color: var(--blue); }
        .color-name { font-size: 10px; color: #555; text-align: center; width: 50px; }

        .profile-modal .modal-content { height: auto; }
        .profile-body { padding: 20px; text-align: center; }
        .profile-avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--bg); margin: 0 auto 15px; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 3px solid var(--purple); }
        .profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: none; }
        .profile-name { font-size: 20px; font-weight: 800; margin-bottom: 5px; }
        .profile-username { color: #888; font-size: 14px; margin-bottom: 20px; }
        .btn-exit-admin { background: var(--coral); color: white; border: none; padding: 12px; border-radius: 8px; width: 100%; margin-top: 20px; font-weight: 800; cursor: pointer; display: none; }
        .btn-exit-admin.show { display: block; }

        .iframe-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: white; z-index: 9999; flex-direction: column; }
        .iframe-modal.active { display: flex; }
        .iframe-header { padding: 15px; background: var(--purple); color: white; display: flex; justify-content: space-between; align-items: center; }
        .iframe-close { background: none; border: none; color: white; font-size: 28px; cursor: pointer; }
        .iframe-body { flex-grow: 1; overflow: hidden; }
        .iframe-body iframe { width: 100%; height: 100%; border: none; }
    .mall-title{font-size:17px;font-weight:800;color:#1c1c1e;margin:18px 2px 10px}
.mall-cats{display:flex;gap:14px;overflow-x:auto;padding:2px 2px 10px;scrollbar-width:none}
.mall-cats::-webkit-scrollbar{display:none}
.mall-cat{flex:0 0 auto;width:78px;display:flex;flex-direction:column;align-items:center;gap:7px;background:none;border:none;padding:0;font-family:inherit}
.mall-ico{width:62px;height:62px;border-radius:18px;display:flex;align-items:center;justify-content:center;box-shadow:0 6px 14px rgba(0,0,0,.15)}
.mall-ico svg{width:32px;height:32px;stroke:#fff;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.mall-cat span{font-size:12px;font-weight:600;color:#1c1c1e;text-align:center}
.mall-cat.on .mall-ico{outline:3px solid #c4b5fd;outline-offset:2px}
.mall-toast{position:fixed;left:50%;bottom:110px;transform:translateX(-50%);background:#1c1c1e;color:#fff;padding:11px 18px;border-radius:14px;font-size:14px;z-index:9999;display:none}
.mall-cats{margin-bottom:-22px}
.mall-cat span{-webkit-hyphens:auto;hyphens:auto;overflow-wrap:anywhere}
.mall-cat.on .mall-ico{outline:none}
.mall-sec{position:fixed;top:0;left:0;right:0;bottom:0;background:#f4f4f6;z-index:900;overflow-y:auto;transform:translateX(100%);transition:transform .25s;padding-bottom:130px}
.mall-sec.open{transform:none}
.mall-sec-top{position:sticky;top:0;display:flex;align-items:center;gap:10px;padding:12px 14px;background:rgba(255,255,255,.95);z-index:2;border-bottom:1px solid #eee}
.mall-back{border:none;background:none;font-size:36px;line-height:1;color:#6D28D9;padding:0 6px}
.mall-sec-ico{width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center;overflow:hidden}
.mall-sec-ico svg{width:20px;height:20px;stroke:#fff;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.mall-sec-name{font-size:20px;font-weight:800;color:#1c1c1e}
.mall-shops{display:flex;gap:14px;overflow-x:auto;padding:14px 16px 6px;scrollbar-width:none}
.mall-shops::-webkit-scrollbar{display:none}
.mall-shop{flex:0 0 auto;width:70px;display:flex;flex-direction:column;align-items:center;gap:5px;background:none;border:none;padding:0;font-family:inherit}
.mall-logo{width:60px;height:60px;border-radius:50%;background:#fff;border:2px solid #e5e5ea;display:flex;align-items:center;justify-content:center;overflow:hidden;font-weight:800;font-size:22px;color:#6D28D9}
.mall-logo img{width:100%;height:100%;object-fit:cover}
.mall-shop.on .mall-logo{border-color:#7C3AED;box-shadow:0 0 0 3px #ede9fe}
.mall-shop span{font-size:11px;font-weight:600;color:#1c1c1e;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}
.xm-ban{height:150px;margin:6px 16px 4px;border-radius:18px;background-size:cover;background-position:center}
.xm-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:12px 16px 90px}
.xm-card{background:#fff;border-radius:18px;overflow:hidden;box-shadow:0 2px 10px rgba(0,0,0,.06);display:flex;flex-direction:column}
.xm-ph{aspect-ratio:1/1;background:#eee center/cover no-repeat}
.xm-in{padding:10px;display:flex;flex-direction:column;gap:4px;flex:1}
.xm-t{font-weight:600;font-size:14px;color:#1c1c1e}.xm-s{font-size:12px;color:#888}
.xm-p{font-weight:800;color:#E11D48;font-size:17px;margin-top:auto}
.xm-add{border:1.5px solid #6D28D9;background:#fff;color:#6D28D9;border-radius:12px;padding:8px;font-weight:700;font-family:inherit}
.xm-empty{text-align:center;color:#888;padding:40px 16px;font-size:15px}
.xm-fab{position:fixed;left:12px;right:12px;bottom:16px;z-index:950;padding:15px;border:none;border-radius:16px;background:#6D28D9;color:#fff;font-weight:700;font-size:15px;box-shadow:0 6px 18px rgba(109,40,217,.35);font-family:inherit}
.xm-sheet{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.45);z-index:1000;display:flex;align-items:flex-end}
.xm-box{background:#fff;width:100%;max-height:88vh;overflow-y:auto;border-radius:20px 20px 0 0;padding:16px;box-sizing:border-box;font-family:inherit}
.xm-hd{display:flex;justify-content:space-between;align-items:center;font-size:17px}.xm-hd button{border:none;background:#f2f2f7;border-radius:50%;width:32px;height:32px}
.xm-it{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-bottom:1px solid #f0f0f0;font-size:14px}
.xm-q{display:flex;align-items:center;gap:10px;font-weight:700}.xm-q button{width:30px;height:30px;border:none;border-radius:8px;background:#ede9fe;color:#6D28D9;font-size:18px}
.xm-sub{font-weight:700;margin:14px 0 6px}
.xm-sv{display:flex;align-items:center;gap:8px;padding:6px 0;font-size:15px}.xm-sv span{margin-left:auto;font-weight:700}
.xm-box input:not([type=checkbox]),.xm-box textarea{width:100%;box-sizing:border-box;font-size:16px;padding:11px;border:1px solid #ddd;border-radius:12px;margin:5px 0;font-family:inherit}
.xm-tot{font-size:18px;font-weight:800;margin:12px 0}
.xm-go{width:100%;padding:15px;border:none;border-radius:14px;background:#6D28D9;color:#fff;font-size:16px;font-weight:700;font-family:inherit}
.xm-er{color:#DC2626;font-size:14px}
.mall-shop span{white-space:normal;line-height:1.2;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
body.mall-open .bottom-nav{z-index:960}body.mall-open .xm-fab{bottom:96px}body.mall-open .modal-overlay{z-index:1100}.mall-sec{padding-bottom:170px}
