/* Курсор pointer для корзины в header */
.cart-btn {
    cursor: pointer !important;
}
/* Стили для кнопки чата в хедере, как в index.php */
.open-chats-btn {
    background: rgb(55, 56, 68) !important;
    color: #444 !important;
    padding: 8px 0px !important;
    border-radius: 6px !important;
    border: none !important;
    cursor: pointer !important;
    transition: 0.2s !important;
    font-size: 14px !important;
    display: inline-block !important;
    box-shadow: none !important;
}
.open-chats-btn:hover {
    background: rgb(55, 56, 68) !important;
    box-shadow: none !important;
    transform: scale(1.045);
}
/* Make header notif button and cart button hover like open-chats-btn */
.open-notifs-btn, .cart-btn { transition: 0.2s !important; }
.open-notifs-btn:hover, .cart-btn:hover {
    background: rgb(55, 56, 68) !important;
    box-shadow: none !important;
    transform: scale(1.045);
}
.open-notifs-btn .notif-icon, .cart-btn svg { transition: transform .12s ease, fill .12s ease; }
.open-notifs-btn:hover .notif-icon { fill: #c7c7c7 !important; transform: translateY(-1px); }
.cart-btn:hover svg path { fill: #c7c7c7 !important; }.open-chats-btn .chat-icon {
    fill: #888 !important;
    stroke: none !important;
}

/* Notification icon button: remove default white background and match header style */
.open-notifs-btn {
    margin-top: 5px;
    background: transparent !important;
    border: none !important;
    padding: 6px 8px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* prefer standard property, keep vendor fallbacks for older engines */
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}
.open-notifs-btn:focus { outline: 2px solid rgba(11,116,222,0.18); }
.open-notifs-btn .notif-icon { fill: #9b9b9b; }
.open-notifs-btn:hover .notif-icon { fill: #c7c7c7; transform: translateY(-1px); }
#header {
 width: 100%;
 height: auto;
}

@keyframes pop {
    0% { transform: scale(0.6); opacity: 0; }
    70% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); }
}

.cap-username {
    margin-right: 15px;
    font-weight: bold;
    color: #fff; /* или другой цвет под твой дизайн */
}

.user-menu {
    position: relative;
    display: inline-block;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px; /* consistent spacing */
    cursor: pointer;
}

/* Ensure all children (buttons, avatar, text) are vertically centered */
.user-info > * {
    display: inline-flex;
    align-items: center;
}

/* Match control heights so items align with avatar */
.open-chats-btn, .cart-btn {
    height: 32px;
    padding: 4px 10px;
    box-sizing: border-box;
}

.user-name {
    line-height: 1; /* let flex centering handle vertical alignment */
    display: inline-block;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
}

.user-name {
    font-weight: bold;
    color: #fff;
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 40px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
    padding: 10px 0;
    min-width: 180px;
    z-index: 100;
}

.user-dropdown a {
    display: block;
    padding: 8px 15px;
    color: #fff;
    text-decoration: none;
}

.user-dropdown a:hover {
    background: rgba(255, 255, 255, 0.12);
}

.user-menu:hover .user-dropdown {
    display: block;
}

/* Бейдж для новых заказов в админке */
.admin-link { position: relative; display: inline-flex; align-items: center; gap:8px; }
.admin-badge {
    display: inline-block;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #ff4d4f;
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(255,80,80,0.18);
    margin-left: 6px;
}

/* badge for favorites link */
.favorites-link .badge {
    display: inline-block;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: #888; /* grey instead of red */
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    margin-left: 4px;
}

.cap {
    border: 0px solid black;
    background-color: rgb(55, 56, 68);
    height: 50px;
    min-height: 50px;
    width: 100%;
    top: 0;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    padding-right: 20px;
}

.cap-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cap-login-btn {
    display: inline-block;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
}

.cap-login-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.cap-login-btn:active {
    transform: translateY(0);
}

.cap-register-btn {
    display: inline-block;
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 20px;
    background: #fff8dc;
    color: #222;
    text-decoration: none;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.cap-register-btn:hover {
    background: #fff;
    color: #222;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.cap-register-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}



/* Контейнер */
.user-menu {
    position: relative;
    display: inline-block;
}

/* Невидимая подушка */
.user-menu::after {
    content: "";
    position: absolute;
    top: 35px;
    right: 0;
    width: 100%;
    height: 18px;
}

/* Аватар + имя + стрелка */
.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: default; /* only avatar itself is clickable now */
}
.user-avatar { cursor: pointer; }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    transition: transform 0.25s ease;
}

.user-menu.open .user-avatar {
    transform: scale(1.08);
}

.user-arrow {
    font-size: 12px;
    opacity: 0.7;
    transition: transform 0.25s ease;
}

.user-menu.open .user-arrow {
    transform: rotate(180deg);
}

/* Выпадающее меню */
.user-dropdown {
    position: absolute;
    right: 0;
    top: 48px;
    min-width: 200px;
    padding: 10px 0;

    background: rgba(30, 30, 30, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;

    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;

    pointer-events: none;
    z-index: 100;
}

/* Появление */
.user-menu.open .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Пункты меню */
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    transition: 0.25s ease;
    opacity: 0;
    transform: translateX(-10px);
}

/* Анимация пунктов по очереди */
.user-menu.open .user-dropdown a {
    opacity: 1;
    transform: translateX(0);
}

.user-dropdown a:nth-child(1) { transition-delay: 0.05s; }
.user-dropdown a:nth-child(2) { transition-delay: 0.10s; }
.user-dropdown a:nth-child(3) { transition-delay: 0.15s; }

/* Иконки */
.user-dropdown .icon {
    width: 20px;
    height: 20px;
    fill: #fff;
    opacity: 0.85;
}

/* Ховер эффект */
.user-dropdown a:hover {
    background: rgba(255, 255, 255, 0.08);
    padding-left: 24px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}
/* show modal when `.open` is toggled by JS */
.modal.open {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 2147483647 !important; /* force topmost */
}

/* Ensure modal content is visible and scrollable when needed */
.modal.open .modal-content {
    transform: none !important;
    max-height: 90vh;
    overflow: auto;
}

.modal-content {
    background: #1e1e1e;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.modal-close {
    float: right;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
}

.modal-close:hover {
    opacity: 1;
}

.crop-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #4caf50;
    border: none;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
}

.crop-btn:hover {
    background: #45a049;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

/* Header notifications dropdown */
.notif-dropdown {
  position: absolute;
  top: 44px;
  right: 0;
  min-width: 320px;
  max-width: 420px;
  background: #0f1417;
  border: 1px solid rgba(255,255,255,0.03);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(2,6,23,0.6);
  z-index: 300;
  overflow: hidden;
  color: #e6f7ff;
  transform-origin: top right;
  animation: pop .14s cubic-bezier(.2,.9,.3,1);
}
.notif-dropdown .nd-header { display:flex;align-items:center;justify-content:space-between;padding:10px 12px;border-bottom:1px solid rgba(255,255,255,0.02); }
.notif-dropdown .nd-list {
  max-height: 360px;
  overflow: auto; /* keep scrolling by wheel/trackpad */
  -ms-overflow-style: none; /* hide scrollbar in IE/Edge */
  scrollbar-width: none; /* hide scrollbar in Firefox */
}
.notif-dropdown .nd-list::-webkit-scrollbar { display: none; } /* hide scrollbar in WebKit/Blink */

/* blur/dim overlay used when a confirmation is open */
.notif-dropdown .nd-blur-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 44px; /* fallback; JS sets precise top */
  background: rgba(6,8,10,0.25);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  z-index: 18;
  transition: opacity .12s ease;
  display: none;
  pointer-events: auto; /* capture clicks and block interactions underneath */
}

/* page-level overlay for global confirms (when dropdown not open) */
.page-blur-overlay {
  position: fixed; inset: 0; background: rgba(6,8,10,0.25); backdrop-filter: blur(4px) saturate(110%); -webkit-backdrop-filter: blur(4px) saturate(110%); z-index: 298; display: none; }

/* ensure global confirm is visible above overlay */
.notif-confirm.global { z-index: 999999 !important; pointer-events: auto; }

/* while confirm open, visually lock the list */
.notif-dropdown.notif-confirm-open .nd-list { pointer-events: none; }
.notif-dropdown .notif-item { display:flex;gap:10px;padding:10px 12px;border-bottom:1px solid rgba(255,255,255,0.02); align-items:flex-start; }
.notif-dropdown .notif-item.unread { background: linear-gradient(90deg, rgba(255,255,255,0.012), rgba(255,255,255,0.006)); }
.notif-dropdown .notif-item .ni-body { flex:1; font-size:13px; color:#cfeff0; }
.notif-dropdown .notif-item .ni-meta { color:#8a8a8a; font-size:12px; min-width:86px; text-align:right; }
.notif-dropdown .ni-actions { display:flex;gap:8px;align-items:center; }
.notif-empty { padding:18px; text-align:center; color:#9aa; font-size:13px; }
.notif-dropdown .nd-footer { padding:8px 12px; display:flex; gap:8px; justify-content:space-between; align-items:center; }
.notif-dropdown a { color:#9cf; text-decoration:none; font-size:13px; }
.notif-dropdown button { background:transparent; border:1px solid rgba(255,255,255,0.04); color:#fff; padding:6px 8px; border-radius:6px; cursor:pointer; }

/* confirmation UI inside notifications dropdown */
.notif-dropdown .notif-confirm { display:flex; gap:10px; align-items:center; justify-content:space-between; padding:8px 10px; margin-top:8px; border-radius:8px; background:linear-gradient(90deg, rgba(255,0,0,0.02), rgba(255,255,255,0.00)); border:1px solid rgba(255,255,255,0.02); box-shadow: 0 6px 18px rgba(2,6,23,0.45); }
.notif-dropdown .notif-confirm .nf-message { color:#f1dede; font-size:13px; flex:1; }
.notif-dropdown .notif-confirm .nf-actions { display:flex; gap:8px; align-items:center; }
.notif-dropdown .notif-confirm .nf-confirm { background:#c73b3b; border:1px solid rgba(0,0,0,0.2); color:#fff; padding:6px 8px; border-radius:6px; cursor:pointer; }
.notif-dropdown .notif-confirm .nf-cancel { background:transparent; border:1px solid rgba(255,255,255,0.04); color:#fff; padding:6px 8px; border-radius:6px; cursor:pointer; }

/* inline spinner inside a notif item (small) */
.inline-spinner { display:inline-block; width:14px; height:14px; border-radius:50%; border:2px solid rgba(255,255,255,0.12); border-top-color: #fff; box-sizing: border-box; animation: spin .8s linear infinite; margin-left:6px; vertical-align:middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toast messages (global) */
.site-toast { position: fixed; right: 20px; top: 20px; background: rgba(0,0,0,0.75); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 99999; opacity: 0; transform: translateY(-6px); transition: opacity .18s ease, transform .18s ease; pointer-events: none; font-size:13px; }
.site-toast.visible { opacity: 1; transform: translateY(0); }
.site-toast.toast-success { background: linear-gradient(180deg,#1b3,#0a2); }
.site-toast.toast-error { background: linear-gradient(180deg,#c73b3b,#8a2a2a); }


/* anchor confirms to items/header to prevent visual overflow */
.notif-dropdown .notif-item { position: relative; }
.notif-dropdown .notif-item .notif-confirm { position: absolute; right: 12px; top: calc(100% + 6px); margin-top: 0; min-width: 200px; max-width: calc(100% - 24px); z-index: 30; box-shadow: 0 8px 24px rgba(2,6,23,0.55); }
.notif-dropdown .nd-header { position: relative; }
.notif-dropdown .nd-header .notif-confirm { position: absolute; right: 12px; top: calc(100% + 6px); margin-top: 0; min-width: 220px; z-index: 30; box-shadow: 0 8px 24px rgba(2,6,23,0.55); }
.notif-dropdown .notif-delete { background:transparent; border:none; color:#ff9b9b; padding:4px 6px; font-size:12px; cursor:pointer; }

/* Prevent tiny horizontal overflow on small screens */
@media (max-width:600px) {
  html, body { overflow-x: hidden; }
}

/* Very small screens: hide username to save space in the header */
@media (max-width:420px) {
  /* hide textual username and caret to prioritize icons */
  .user-name, .user-arrow { display: none !important; }

  /* tighten gap slightly for very narrow screens */
  .cap-actions { gap: 6px; }
}

@media (max-width:400px) {
.cap-actions {
   position: absolute;
    right: 12px;
 }

 }