.profile-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    transition: background 0.3s ease;
}

.profile-overlay.active {
    background: rgba(0, 0, 0, 0.4);
    pointer-events: all;
}

.profile-screen {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: var(--bg);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}

.profile-overlay.active .profile-screen {
    transform: translateY(0);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 2;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
}

.profile-close {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.profile-close:active {
    transform: scale(0.9);
}

.profile-close svg {
    width: 18px;
    height: 18px;
    color: var(--text);
}

/* ======= Profile sub-page push transition ======= */
.profile-screen.profile-push > * {
    animation: profilePushIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.profile-screen.profile-push > :first-child { animation-delay: 0.02s; }
.profile-screen.profile-push > :nth-child(2) { animation-delay: 0.07s; }
.profile-screen.profile-push > :nth-child(3) { animation-delay: 0.12s; }

@keyframes profilePushIn {
    from {
        opacity: 0;
        transform: translateX(26px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.profile-header-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.profile-user {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 28px;
    gap: 8px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 4px;
}

.profile-avatar svg {
    width: 40px;
    height: 40px;
    color: var(--text-secondary);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-name {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
    text-align: center;
}

.profile-username {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
}

.profile-menu {
    padding: 0 12px;
    margin-bottom: 20px;
}

.profile-section {
    padding: 0 12px;
    margin-bottom: 20px;
}

.profile-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0 6px 8px;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 14px;
    width: 100%;
    text-align: left;
    border-radius: 16px;
    background: var(--card);
    margin-bottom: 6px;
    transition: background 0.15s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.profile-menu-item:active {
    background: var(--card-hover);
    transform: scale(0.97);
}

.profile-menu-item:last-child {
    margin-bottom: 0;
}

.profile-menu-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-menu-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text);
}

.profile-menu-text {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.profile-menu-arrow {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 32px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-secondary);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    background: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: var(--accent-text);
}

.profile-footer {
    text-align: center;
    padding: 20px 16px 30px;
}

.profile-footer-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    opacity: 0.6;
}

.info-content {
    padding: 0 12px;
}

.info-block {
    background: var(--card);
    border-radius: 16px;
    padding: 18px 16px;
    margin-bottom: 10px;
}

.info-block h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.info-block p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 4px;
}

.info-block p:last-child {
    margin-bottom: 0;
}

.links-content {
    padding: 0 12px;
}

.links-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--card);
    border-radius: 16px;
    margin-bottom: 6px;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.links-item:active {
    background: var(--card-hover);
    transform: scale(0.97);
}

.links-item:active .links-icon {
    transform: scale(0.92);
}

.links-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.links-icon svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
}

.links-text {
    flex: 1;
    min-width: 0;
}

.links-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
}

.links-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.links-arrow {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* ======= Admin panel ======= */
.admin-content {
    padding: 4px 12px 40px;
}

.admin-block-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 14px 6px 8px;
}

.admin-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    flex: 1;
}

.admin-field-row {
    display: flex;
    gap: 12px;
}

.admin-photo-upload {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 3;
    border: 2px dashed var(--text-secondary);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--card);
    opacity: 0.85;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.admin-photo-upload:active {
    opacity: 1;
}

.admin-photo-upload.has-photo {
    border-color: transparent;
    background: var(--card);
}

.admin-photo-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.admin-photo-empty svg {
    width: 34px;
    height: 34px;
}

.admin-photo-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-photo-clear {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.admin-photo-clear svg {
    width: 15px;
    height: 15px;
}

.admin-product-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--bg-secondary);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-product-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-photo-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.admin-photo-btn:active {
    transform: scale(0.9);
}

.admin-photo-btn:disabled {
    opacity: 0.5;
}

.admin-photo-btn svg {
    width: 18px;
    height: 18px;
}

.admin-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding-left: 4px;
}

.admin-input {
    width: 100%;
    background: var(--card);
    border: 1px solid transparent;
    border-radius: 14px;
    padding: 14px 14px;
    font-size: 16px;
    color: var(--text);
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.admin-input:focus {
    border-color: var(--accent);
}

.admin-textarea {
    resize: none;
    line-height: 1.4;
}

.admin-select option {
    color: #000;
}

.admin-submit-btn {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: -0.01em;
    transition: transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.15s ease;
}

.admin-submit-btn:active {
    transform: scale(0.97);
}

.admin-submit-btn:disabled {
    opacity: 0.6;
}

.admin-products-title {
    padding-top: 26px;
}

.admin-product-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-loading {
    padding: 18px 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.admin-product-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: var(--card);
    border-radius: 16px;
}

.admin-product-info {
    flex: 1;
    min-width: 0;
}

.admin-product-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-product-meta {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.admin-delete-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #FF453A;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.admin-delete-btn:active {
    transform: scale(0.9);
}

.admin-delete-btn:disabled {
    opacity: 0.5;
}

.admin-delete-btn svg {
    width: 18px;
    height: 18px;
}

/* ======= Toast ======= */
#app-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--safe-bottom, 0px) + 24px);
    transform: translateX(-50%) translateY(16px);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 11px 18px;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    z-index: 200;
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    max-width: 80vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

#app-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
