/* Admin Panel Mobile Styles */
@media (max-width: 768px) {
    .admin-sidebar {
        width: 250px;
        transform: translateX(-100%);
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
        padding: 15px;
    }

    .admin-header {
        padding: 15px;
        font-size: 1.2rem;
    }

    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .admin-table {
        font-size: 0.85rem;
    }

    .admin-table th,
    .admin-table td {
        padding: 8px 6px;
    }

    .admin-form {
        padding: 15px;
    }

    .admin-form .form-group {
        margin-bottom: 15px;
    }
}

/* Extra Small Mobile Admin */
@media (max-width: 480px) {
    .admin-sidebar {
        width: 220px;
    }

    .admin-main {
        padding: 10px;
    }

    .admin-header {
        padding: 10px;
        font-size: 1.1rem;
    }

    .admin-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .admin-table {
        font-size: 0.8rem;
    }

    .admin-form {
        padding: 10px;
    }
}

/* Additional Mobile Improvements */

/* Better Typography Scaling */
@media (max-width: 768px) {
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.6rem; }
    h3 { font-size: 1.4rem; }
    h4 { font-size: 1.2rem; }
    p { font-size: 0.95rem; line-height: 1.6; }
}

/* Improved Touch Targets */
@media (max-width: 768px) {
    button,
    .btn,
    a[role="button"],
    input[type="button"],
    input[type="submit"] {
        min-height: 44px;
        min-width: 44px;
    }

    .product-card,
    .signature-card {
        cursor: pointer;
    }
}

/* Better Image Loading */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
}

/* Improved Spacing */
@media (max-width: 768px) {
    .container,
    .page-wrapper {
        padding-left: 15px;
        padding-right: 15px;
    }

    section {
        margin-bottom: 30px;
    }
}

/* Better Form Accessibility */
@media (max-width: 768px) {
    label {
        display: block;
        margin-bottom: 5px;
        font-weight: 600;
    }

    input,
    textarea,
    select {
        width: 100%;
        box-sizing: border-box;
    }
}

/* Extra Small Mobile (iPhone SE etc.) */
@media (max-width: 360px) {
    .sweets-grid {
        grid-template-columns: 1fr !important;
    }
    .mobile-sidebar {
        width: 90%;
    }
}

/* --- Account Page Layout --- */
.profile-container {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    align-items: start;
    padding: 30px 20px;
}

.profile-sidebar {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    padding: 30px 20px;
    position: sticky;
    top: 100px;
    text-align: center;
}

.profile-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    margin-top: 20px;
}

.profile-nav-link {
    padding: 12px 15px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 10px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-nav-link i {
    width: 20px;
    text-align: center;
    color: #aaa;
}

.profile-nav-link:hover,
.profile-nav-link.active {
    background-color: #FFF7E6;
    color: #3E2723;
    font-weight: 700;
}

.profile-nav-link:hover i,
.profile-nav-link.active i {
    color: #D4AF37;
}

.profile-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    padding: 30px;
    min-height: 500px;
}

.profile-tab-content {
    display: none;
}

.profile-tab-content.active {
    display: block;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    position: absolute;
    top: 18px;
    right: 18px;
    color: #555;
    font-size: 1.1rem;
}

/* --- Account Mobile Sidebar Fixes --- */
.sidebar-hamburger { display: none; }
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.5); z-index: 2005; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; pointer-events: none; }
.sidebar-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }

@media (max-width: 900px) {
    .page-wrapper,
    .profile-container {
        padding: 0;
        display: block;
        margin: 0;
    }

    .sidebar-hamburger {
        display: flex;
        position: fixed;
        top: 18px;
        left: 18px;
        background: #D4AF37;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        border: none;
        z-index: 2020;
        cursor: pointer;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 6px;
        box-shadow: 0 4px 16px rgba(0,0,0,0.25);
        padding: 0;
    }
    .sidebar-hamburger span {
        display: block;
        width: 24px;
        height: 3px;
        background-color: #fff;
        border-radius: 999px;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }
    .sidebar-hamburger.active span:nth-child(1) {
        transform: translateY(6px) rotate(45deg);
    }
    .sidebar-hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    .sidebar-hamburger.active span:nth-child(3) {
        transform: translateY(-6px) rotate(-45deg);
    }
    .profile-sidebar {
        position: fixed;
        top: 0;
        left: -110%;
        width: min(90vw, 320px);
        max-width: 320px;
        height: 100vh;
        z-index: 2010;
        transition: left 0.3s ease;
        background: #FAF3E0;
        box-shadow: 2px 0 20px rgba(0,0,0,0.12);
        overflow-y: auto;
        padding-top: 72px;
        margin: 0;
    }
    .profile-sidebar.active { left: 0; }
    .profile-sidebar .sidebar-close-btn {
        display: flex;
        position: absolute;
        top: 16px;
        right: 16px;
        width: 42px;
        height: 42px;
        border: none;
        border-radius: 50%;
        background: rgba(255,255,255,0.9);
        color: #3E2723;
        font-size: 1rem;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    .profile-sidebar .sidebar-close-btn:hover {
        background: #fff;
    }
    .profile-content {
        width: 100% !important;
        margin-left: 0 !important;
        position: relative;
        z-index: 1;
        padding: 20px;
    }
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Variant Buttons Mobile Fix */
@media (max-width: 768px) {
    .variant-button-group {
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center;
    }
    .variant-btn {
        flex: 1 1 45% !important;
        min-width: 0;
    }
    .variant-btn span {
        font-size: 0.85rem !important;
        padding: 6px 4px !important;
        word-wrap: break-word !important;
        white-space: normal !important;
    }
}