/* =========================================================
   INSTAWORKS RESPONSIVE SYSTEM
   ========================================================= */


/* =========================================================
   RESPONSIVE VARIABLES
   ========================================================= */

:root {
    --instaworks-purple: #6c248f;
    --instaworks-purple-dark: #54206f;
    --instaworks-purple-light: #f5eff9;

    --mobile-header-height: 68px;
    --mobile-bottom-height: 72px;

    --responsive-border: #e8e5eb;
    --responsive-text: #111827;
    --responsive-muted: #6b7280;
}


/* =========================================================
   GLOBAL RESPONSIVE SAFETY
   ========================================================= */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    padding-bottom: 0;
}

img {
    max-width: 100%;
    height: auto;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}


/* =========================================================
   MAIN NAVBAR - COMMON
   ========================================================= */

.instaworks-responsive-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;

    width: 100%;

    background: #ffffff;

    border-bottom: 1px solid var(--responsive-border);

    box-shadow:
        0 2px 15px rgba(17, 24, 39, 0.05);
}

.navbar-container {
    min-height: 76px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    position: relative;
}


/* =========================================================
   BRAND
   ========================================================= */

.instaworks-brand {
    display: flex !important;
    align-items: center;

    margin: 0 !important;
    padding: 0 !important;

    color: var(--responsive-text) !important;

    text-decoration: none;

    white-space: nowrap;
}

.instaworks-logo {
    width: 64px !important;
    height: 64px !important;

    object-fit: contain;

    margin-right: 8px;

    flex-shrink: 0;
}

.instaworks-brand .brand-primary {
    color: var(--instaworks-purple) !important;
}

.instaworks-brand span {
    font-size: 28px;
    line-height: 1;

    font-weight: 700;

    letter-spacing: -1px;
}


/* =========================================================
   DESKTOP NAVIGATION
   1200px+
   ========================================================= */

.desktop-navigation {
    display: flex;

    align-items: center;
    justify-content: flex-end;

    gap: 22px;

    flex: 1;
}

.desktop-nav-list {
    display: flex;

    align-items: center;

    gap: 2px;

    margin: 0;
    padding: 0;

    list-style: none;
}

.desktop-nav-link {
    display: inline-flex;
    align-items: center;

    padding: 10px 11px;

    color: var(--responsive-text);

    border-radius: 9px;

    font-size: 0.92rem;
    font-weight: 600;

    white-space: nowrap;

    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.desktop-nav-link:hover {
    color: var(--instaworks-purple);

    background: var(--instaworks-purple-light);
}

.desktop-navigation-actions {
    display: flex;

    align-items: center;

    gap: 8px;
}

.desktop-navigation-actions .btn {
    white-space: nowrap;
}


/* =========================================================
   TABLET NAVIGATION
   768px - 1199px
   ========================================================= */

.tablet-navigation {
    display: none;

    align-items: center;

    gap: 8px;
}

.tablet-nav-link {
    display: inline-flex;
    align-items: center;

    padding: 9px 12px;

    color: var(--responsive-text);

    border-radius: 9px;

    font-size: 0.9rem;
    font-weight: 600;

    text-decoration: none;
}

.tablet-nav-link:hover {
    color: var(--instaworks-purple);

    background: var(--instaworks-purple-light);
}


/* =========================================================
   TABLET / MOBILE MORE BUTTON
   ========================================================= */

.more-menu-button,
.mobile-more-button {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 46px;
    height: 46px;

    padding: 0;

    color: var(--responsive-text);

    background: #ffffff;

    border: 1.5px solid #dcd9df;

    border-radius: 13px;

    font-size: 1.35rem;

    cursor: pointer;

    transition:
        color 0.2s ease,
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.2s ease;
}

.more-menu-button:hover,
.mobile-more-button:hover {
    color: var(--instaworks-purple);

    border-color: var(--instaworks-purple);

    background: var(--instaworks-purple-light);
}

.more-menu-button:active,
.mobile-more-button:active {
    transform: scale(0.94);
}


/* =========================================================
   MOBILE HEADER
   Below 768px
   ========================================================= */

.mobile-navigation {
    display: none;

    align-items: center;
    justify-content: flex-end;
}


/* =========================================================
   MORE MENU OVERLAY
   ========================================================= */

.more-menu-overlay {
    position: fixed;

    inset: 0;

    z-index: 1090;

    background: rgba(17, 24, 39, 0.38);

    opacity: 0;

    visibility: hidden;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;

    backdrop-filter: blur(3px);
}

.more-menu-overlay.is-open {
    opacity: 1;

    visibility: visible;
}


/* =========================================================
   MORE MENU SHEET
   ========================================================= */

.more-menu-sheet {
    position: fixed;

    left: 50%;

    bottom: 0;

    z-index: 1100;

    width: min(100%, 520px);

    max-height: 82vh;

    overflow-y: auto;

    padding:
        10px
        20px
        calc(20px + env(safe-area-inset-bottom));

    background: #ffffff;

    border-radius: 26px 26px 0 0;

    box-shadow:
        0 -15px 50px rgba(17, 24, 39, 0.16);

    transform:
        translate(-50%, 105%);

    transition:
        transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);

    visibility: hidden;
}

.more-menu-sheet.is-open {
    transform: translate(-50%, 0);

    visibility: visible;
}


/* =========================================================
   SHEET HANDLE
   ========================================================= */

.more-menu-handle {
    width: 42px;
    height: 4px;

    margin: 3px auto 18px;

    background: #d7d3da;

    border-radius: 999px;
}


/* =========================================================
   SHEET HEADER
   ========================================================= */

.more-menu-header {
    display: flex;

    align-items: center;
    justify-content: space-between;

    gap: 15px;

    padding-bottom: 15px;

    border-bottom: 1px solid var(--responsive-border);
}

.more-menu-label {
    display: block;

    color: var(--responsive-text);

    font-size: 1.3rem;
    font-weight: 800;
}

.more-menu-user {
    display: block;

    margin-top: 2px;

    color: var(--responsive-muted);

    font-size: 0.8rem;
}

.more-menu-close {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 38px;
    height: 38px;

    color: #6b7280;

    background: #f5f3f6;

    border: 0;

    border-radius: 50%;

    cursor: pointer;
}

.more-menu-close:hover {
    color: var(--instaworks-purple);

    background: var(--instaworks-purple-light);
}


/* =========================================================
   MENU SECTION
   ========================================================= */

.more-menu-section {
    padding: 10px 0;

    border-bottom: 1px solid var(--responsive-border);
}

.more-menu-section:last-of-type {
    border-bottom: 0;
}


/* =========================================================
   MENU ITEM
   ========================================================= */

.more-menu-item {
    display: flex;

    align-items: center;

    min-height: 54px;

    gap: 12px;

    padding: 7px 4px;

    color: var(--responsive-text);

    text-decoration: none;

    border-radius: 12px;

    font-size: 0.95rem;
    font-weight: 600;

    transition:
        color 0.2s ease,
        background 0.2s ease;
}

.more-menu-item:hover {
    color: var(--instaworks-purple);

    background: var(--instaworks-purple-light);
}

.more-menu-icon {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;

    flex-shrink: 0;

    color: var(--instaworks-purple);

    background: var(--instaworks-purple-light);

    border-radius: 11px;

    font-size: 1.1rem;
}

.more-menu-arrow {
    margin-left: auto;

    color: #9ca3af;

    font-size: 0.8rem;
}


/* =========================================================
   AUTH AREA
   ========================================================= */

.more-menu-auth {
    display: flex;

    gap: 10px;

    padding-top: 15px;
}

.more-menu-auth form {
    flex: 1;

    margin: 0;
}

.more-menu-login,
.more-menu-register,
.more-menu-logout {
    display: flex;

    align-items: center;
    justify-content: center;

    min-height: 48px;

    padding: 10px 18px;

    border-radius: 11px;

    font-weight: 700;

    text-decoration: none;

    cursor: pointer;
}

.more-menu-login {
    flex: 1;

    color: var(--instaworks-purple);

    background: #ffffff;

    border: 1px solid var(--instaworks-purple);
}

.more-menu-register {
    flex: 1;

    color: #ffffff;

    background: var(--instaworks-purple);

    border: 1px solid var(--instaworks-purple);
}

.more-menu-logout {
    width: 100%;

    gap: 8px;

    color: #dc3545;

    background: #fff5f5;

    border: 1px solid #ffd7d7;
}


/* =========================================================
   MOBILE BOTTOM NAVIGATION
   ========================================================= */

.mobile-bottom-navigation {
    display: none;
}


/* =========================================================
   MOBILE
   < 768px
   ========================================================= */

@media (max-width: 767.98px) {

    body {
        padding-bottom:
            calc(
                var(--mobile-bottom-height)
                + env(safe-area-inset-bottom)
            );
    }


    /* Header */

    .instaworks-responsive-navbar {
        min-height: var(--mobile-header-height);

        box-shadow:
            0 2px 12px rgba(17, 24, 39, 0.06);
    }

    .navbar-container {
        min-height: var(--mobile-header-height);

        padding-left: 16px;
        padding-right: 16px;
    }


    /* Logo */

    .instaworks-logo {
        width: 42px !important;
        height: 42px !important;

        margin-right: 7px;
    }

    .instaworks-brand span {
        font-size: 23px;

        letter-spacing: -0.7px;
    }


    /* Hide desktop/tablet */

    .desktop-navigation,
    .tablet-navigation {
        display: none;
    }


    /* Show mobile */

    .mobile-navigation {
        display: flex;
    }


    .mobile-more-button {
        width: 44px;
        height: 44px;

        border-radius: 12px;

        font-size: 1.3rem;
    }


    /* Bottom navigation */

    .mobile-bottom-navigation {
        position: fixed;

        left: 0;
        right: 0;
        bottom: 0;

        z-index: 1050;

        display: grid;

        grid-template-columns:
            repeat(5, 1fr);

        min-height: var(--mobile-bottom-height);

        padding:
            7px
            5px
            calc(7px + env(safe-area-inset-bottom));

        background: rgba(255, 255, 255, 0.97);

        border-top: 1px solid var(--responsive-border);

        box-shadow:
            0 -5px 25px rgba(17, 24, 39, 0.08);

        backdrop-filter: blur(15px);
    }


    .mobile-bottom-nav-item {
        display: flex;

        flex-direction: column;

        align-items: center;
        justify-content: center;

        gap: 3px;

        min-width: 0;

        padding: 5px 2px;

        color: #6b7280;

        background: transparent;

        border: 0;

        border-radius: 10px;

        font-size: 0.67rem;
        font-weight: 600;

        text-decoration: none;

        cursor: pointer;

        transition:
            color 0.2s ease,
            background 0.2s ease;
    }


    .mobile-bottom-nav-item i {
        font-size: 1.12rem;

        line-height: 1;
    }


    .mobile-bottom-nav-item:hover,
    .mobile-bottom-nav-item:focus {
        color: var(--instaworks-purple);

        background: var(--instaworks-purple-light);
    }


    .mobile-bottom-more {
        font-family: inherit;
    }


    /* More sheet */

    .more-menu-sheet {
        width: 100%;

        max-height: 84vh;

        padding-left: 18px;
        padding-right: 18px;
    }


    /* Main content */

    #main-content {
        min-height: calc(100vh - var(--mobile-header-height));
    }

}


/* =========================================================
   TABLET
   768px - 1199px
   ========================================================= */

@media (min-width: 768px) and (max-width: 1199.98px) {

    .navbar-container {
        min-height: 74px;

        padding-left: 20px;
        padding-right: 20px;
    }


    .instaworks-logo {
        width: 56px !important;
        height: 56px !important;
    }


    .instaworks-brand span {
        font-size: 25px;
    }


    .desktop-navigation {
        display: none;
    }


    .tablet-navigation {
        display: flex;
    }


    .mobile-navigation {
        display: none;
    }


    .mobile-bottom-navigation {
        display: none;
    }


    .more-menu-sheet {
        width: min(430px, 100%);

        border-radius: 22px 22px 0 0;
    }

}


/* =========================================================
   LARGE DESKTOP
   1200px+
   ========================================================= */

@media (min-width: 1200px) {

    .desktop-navigation {
        display: flex;
    }

    .tablet-navigation,
    .mobile-navigation,
    .mobile-bottom-navigation {
        display: none;
    }

}


/* =========================================================
   SMALL MOBILE
   <= 390px
   ========================================================= */

@media (max-width: 390px) {

    .instaworks-logo {
        width: 38px !important;
        height: 38px !important;
    }

    .instaworks-brand span {
        font-size: 21px;
    }

    .mobile-bottom-nav-item {
        font-size: 0.62rem;
    }

    .mobile-bottom-nav-item i {
        font-size: 1.05rem;
    }

}


/* =========================================================
   REDUCE MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;

        transition-duration: 0.01ms !important;

        animation-duration: 0.01ms !important;
    }

}