/* =========================================================
   KINOPIRON MEDIA.CSS
   Clean Responsive Layout System
   Breakpoints:
   1200px = hide right sidebar
   900px  = mobile drawer layout
   600px  = phone polish
========================================================= */

/* ===============================
   BASE SAFETY
=============================== */

* {
    box-sizing: border-box;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

img {
    max-width: 100%;
}

input,
textarea,
select,
button {
    max-width: 100%;
    box-sizing: border-box;
}

/* ===============================
   MOBILE SIDEBAR DEFAULTS
=============================== */

.mobile-menu-btn {
    display: none;
}

.mobile-sidebar-overlay {
    display: none;
}

/* ===============================
   TABLETS / SMALL LAPTOPS
=============================== */

@media (max-width: 1200px) {

    .right-sidebar {
        display: none !important;
    }

    .container,
    .main-container,
    .content-container,
    .layout-container,
    .page-container {
        max-width: 100% !important;
    }

    .main-content,
    .home-main-content,
    .content-area,
    main {
        margin-right: 0 !important;
        max-width: 100% !important;
    }

    .search-box {
        width: 220px;
    }

    .shops-grid,
    .shop-grid,
    .games-grid,
    .groups-directory,
    .inventory-grid,
    .pets-grid {
        max-width: 100%;
    }
}

/* ===============================
   DRAWER MODE / TABLET
=============================== */

@media (max-width: 900px) {

    body {
        overflow-x: hidden;
    }

    nav {
        position: sticky;
        top: 0;
        z-index: 1000;
        min-height: 60px;
        padding: 8px 10px;
    }

    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;

        width: 38px;
        height: 38px;
        margin-right: 6px;

        border: 1px solid #d9c7ff;
        border-radius: 12px;
        background: linear-gradient(135deg, #f5ecff, #eaf6ff);
        color: #6b4fb8;

        font-size: 24px;
        font-weight: bold;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(120, 92, 180, 0.18);
    }

    .logo {
        height: 42px;
        max-width: 155px;
    }

    .nav-left {
        gap: 6px;
        min-width: 0;
    }

    .nav-left ul li {
        margin: 0 3px;
    }

    .nav-left ul li img {
        width: 24px;
        height: 24px;
    }

    .nav-right {
        gap: 8px;
        margin: 0;
    }

    .search-box {
        display: none !important;
    }

    .nav-user-icon {
        margin-left: 0;
    }

    .nav-user-icon img {
        width: 38px;
        height: 38px;
    }

    .settings-menu {
        top: 60px;
        right: 8px;
        width: calc(100vw - 20px);
        max-width: 310px;
        box-sizing: border-box;
    }

    .notif-dropdown {
        position: fixed !important;
        top: 64px !important;
        left: 10px !important;
        right: 10px !important;
        transform: none !important;
        width: auto !important;
        max-height: 70vh;
        box-sizing: border-box;
    }

    .left-sidebar {
        display: block !important;
        position: fixed !important;
        top: 60px !important;
        left: 0 !important;
        z-index: 2000 !important;

        width: 270px !important;
        max-width: 85vw !important;
        height: calc(100vh - 60px) !important;

        padding: 18px !important;
        box-sizing: border-box;

        background: linear-gradient(180deg, #ffffff 0%, #f8f1ff 100%) !important;
        border-right: 1px solid #e5d7ff !important;
        box-shadow: 8px 0 25px rgba(70, 49, 120, 0.22) !important;

        overflow-y: auto !important;

        transform: translateX(-105%) !important;
        transition: transform 0.25s ease !important;
    }

    body.mobile-menu-open .left-sidebar {
        transform: translateX(0) !important;
    }

    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 60px 0 0 0;
        z-index: 1500;
        background: rgba(25, 18, 40, 0.45);
    }

    body.mobile-menu-open .mobile-sidebar-overlay {
        display: block;
    }

    .left-sidebar .imp-links {
        display: flex;
        flex-direction: column;
        gap: 4px;
        margin: 0 0 18px;
        padding: 0;
    }

    .left-sidebar .sidebar-title {
        margin: 14px 0 8px;
        color: #7a5ac9;
        font-size: 13px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .left-sidebar .imp-links a {
        display: flex;
        align-items: center;
        margin: 0 0 8px;
        padding: 9px 10px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.75);
        color: #3f3658;
        font-size: 14px;
        text-decoration: none;
        white-space: nowrap;
    }

    .left-sidebar .imp-links a img {
        width: 28px;
        height: 28px;
        object-fit: contain;
        margin-right: 10px;
        flex-shrink: 0;
    }

    .left-sidebar .imp-links a:hover {
        background: linear-gradient(135deg, #d492fd, #91caff);
        color: #fff;
    }

    .right-sidebar {
        display: none !important;
    }

    .container,
    .main-container,
    .content-container,
    .layout-container,
    .page-container,
    .main-content,
    .home-main-content,
    .content-area,
    main {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .container {
        flex-direction: column;
    }
}

/* ===============================
   PHONE HEADER
=============================== */

@media (max-width: 600px) {

    nav {
        min-height: 54px;
        padding: 6px 8px;
    }

    .logo {
        height: 38px;
        max-width: 135px;
    }

    .nav-left ul li img {
        width: 22px;
        height: 22px;
    }

    .nav-user-icon img {
        width: 34px;
        height: 34px;
    }

    .notif-badge {
        min-width: 16px;
        height: 16px;
        font-size: 9px;
        padding: 0 4px;
    }
}

/* ===============================
   PAGE HEADERS
=============================== */

@media (max-width: 900px) {

    .shops-hero-card,
    .shops-header,
    .groups-page-heading,
    .games-header,
    .inventory-header,
    .neo-shop-header {
        padding: 14px !important;
        text-align: left !important;
    }

    .shops-hero-card h1,
    .shops-header h1,
    .groups-page-heading h1,
    .games-header h1,
    .inventory-header h1,
    .neo-shop-header h1,
    .mypets-title,
    .explore-title,
    .cartographer-title {
        font-size: 24px !important;
        line-height: 1.2;
    }
}

/* ===============================
   INDEX / POSTS
=============================== */

@media (max-width: 900px) {

    .post-container,
    .write-post-container {
        padding: 14px;
        border-radius: 18px;
    }

    .user-profile img,
    .post-avatar {
        width: 42px;
        height: 42px;
    }

    .post-username {
        font-size: 16px;
    }

    .post-text {
        font-size: 14px;
    }
}

/* ===============================
   SHOPS
=============================== */

@media (max-width: 900px) {

    .shops-page,
    .shop-view-page {
        max-width: 100%;
        padding: 12px 10px 28px;
    }

    .shops-hero-text {
        padding: 14px;
    }

    .shops-grid,
    .shop-grid {
        grid-template-columns: 1fr !important;
        gap: 14px !important;
    }

    .shop-card {
        width: 100% !important;
    }

    .shop-card-banner img {
        width: 100%;
        max-height: 150px;
        object-fit: contain;
    }

    .shop-enter-btn,
    .shop-back-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .neo-shop-wrap {
        border-radius: 14px;
    }

    .neo-banner img {
        width: 100%;
        max-width: 420px;
        height: auto;
        max-height: 140px;
        object-fit: contain;
    }

    .neo-shop-description {
        font-size: 14px;
    }

    .neo-shop-inventory h2 {
        font-size: 18px;
        padding: 10px;
    }

    .neo-items-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
        padding: 14px 12px 10px;
    }

    .neo-item {
        padding: 8px 4px 10px;
    }

    .neo-item-image-wrap {
        min-height: 76px;
    }

    .neo-item img {
        width: 68px;
        height: 68px;
    }

    .neo-buy-btn,
    .buy-cancel-btn {
        width: 100%;
        box-sizing: border-box;
    }

    .buy-modal-content {
        max-width: 320px;
        padding: 16px;
    }

    .buy-modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 420px) {

    .neo-items-grid {
        grid-template-columns: 1fr;
    }
}

/* ===============================
   GROUPS
=============================== */

@media (max-width: 900px) {

    .groups-page {
        max-width: 100%;
        padding: 10px;
    }

    .groups-header-card,
    .groups-panel,
    .group-hero-card,
    .group-card {
        border-radius: 16px;
    }

    .groups-header-card,
    .groups-panel {
        padding: 14px;
        margin-bottom: 14px;
    }

    .groups-panel-top,
    .groups-section-header,
    .group-hero-content,
    .group-card-head,
    .group-card-actions,
    .group-rank-row,
    .leader-tools-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .groups-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .group-directory-row {
        grid-template-columns: 1fr !important;
        gap: 10px;
        padding: 14px;
    }

    .group-directory-main {
        width: 100%;
    }

    .group-directory-stats {
        width: 100%;
        border-left: 0 !important;
        border-top: 1px solid #e2d5ff;
        padding-top: 8px;
    }

    .group-directory-actions {
        width: 100%;
        justify-content: stretch;
    }

    .group-view-btn,
    .group-join-btn,
    .create-group-btn,
    .group-secondary-btn,
    .group-leave-btn,
    .group-delete-btn,
    .group-locked-note,
    .group-full-badge {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
        justify-content: center;
    }

    .group-hero-banner {
        height: 70px;
    }

    .group-hero-content {
        padding: 14px;
    }

    .group-hero-stats {
        min-width: 0;
        width: 100%;
        flex-direction: column;
    }

    .group-stat-box,
    .group-rank-box {
        width: 100%;
    }

    .group-members-compact {
        gap: 5px;
    }

    .group-member-compact img {
        width: 34px;
        height: 34px;
        border-radius: 9px;
    }

    .group-feed-post {
        padding: 12px;
        border-radius: 14px;
    }

    .group-feed-avatar {
        width: 42px;
        height: 42px;
    }

    .group-manage-summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .group-member-manage-card {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .group-member-manage-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .group-member-manage-actions form {
        width: 100%;
    }
}

/* ===============================
   FORUMS
=============================== */

@media (max-width: 900px) {

    .forum-container {
        margin: 12px 8px;
        padding: 14px;
        border-radius: 14px;
    }

    .forum-container h1 {
        font-size: 22px;
    }

    .forum-header-row,
    .reply-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .forum-button {
        width: 100%;
        text-align: center;
    }

    .forum-category-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .forum-category-stats {
        width: 100%;
        min-width: 0;
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .thread-card {
        grid-template-columns: 20px 1fr;
        gap: 8px;
        padding: 12px;
    }

    .thread-meta {
        grid-column: 2;
        width: 100%;
        min-width: 0;
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }

    .post-card {
        flex-direction: column;
        gap: 8px;
    }

    .post-side {
        width: 100%;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 8px;
        text-align: left;
    }

    .post-side img {
        width: 44px;
        height: 44px;
        margin-bottom: 0;
    }

    .post-main,
    .reply-box {
        width: 100%;
        max-width: 100%;
    }

    .post-meta-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .post-meta-actions {
        width: 100%;
        justify-content: space-between;
    }

    .emoji-picker {
        left: 0;
        width: 210px;
    }
}

/* ===============================
   FRIENDS
=============================== */

@media (max-width: 900px) {

    .friends-page {
        max-width: 100%;
        padding: 10px 10px 24px;
    }

    .friend-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .friend-card {
        border-radius: 16px;
        padding: 14px;
    }

    .friend-actions {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    .friend-btn {
        flex: 1;
        min-width: 110px;
    }
}

/* ===============================
   EXPLORE / CARTOGRAPHER
=============================== */

@media (max-width: 900px) {

    .explore-page,
    .cartographer-page {
        max-width: 100%;
        padding: 12px 10px 28px;
    }

    .explore-map-wrap {
        max-width: 100%;
        overflow-x: auto;
    }

    .map-region {
        padding: 2px 6px;
        font-size: 8px;
        border-width: 1px;
    }

    .map-link {
        padding: 4px 7px;
        font-size: 10px;
    }

    .explore-links-panel,
    .cartographer-panel,
    .cartographer-map-card,
    .cartographer-intro-card {
        padding: 14px;
        border-radius: 14px;
    }

    .explore-links-list a,
    .cartographer-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }

    .cartographer-intro-card {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 10px;
    }

    .cartographer-npc-image {
        max-width: 120px;
        max-height: 145px;
        margin: 0 auto;
    }

    .cartographer-maps-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .cartographer-piece-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
}

@media (max-width: 420px) {

    .map-region {
        font-size: 7px;
        padding: 2px 5px;
    }

    .cartographer-piece-grid {
        grid-template-columns: 1fr;
    }
}

/* ===============================
   CREATE PET
=============================== */

@media (max-width: 900px) {

    .create-pet-main,
    .create-pet-details-main {
        max-width: 100%;
        padding: 12px 10px 28px;
    }

    .create-pet-details-main h1,
    .create-pet-main h1 {
        font-size: 22px;
        line-height: 1.2;
    }

    .species-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .species-card {
        min-height: 260px;
        padding: 12px;
    }

    .species-card img {
        max-width: 135px;
        height: 120px;
    }

    #species-image {
        max-width: 220px !important;
    }

    .color-options {
        grid-template-columns: repeat(2, 100px);
        gap: 10px;
    }

    .submit-btn,
    .select-btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 420px) {

    .species-grid {
        grid-template-columns: 1fr;
    }

    .color-options {
        grid-template-columns: repeat(2, 90px);
    }

    .color-swatch {
        width: 90px;
    }
}

@media (max-width: 520px) {
    .species-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===============================
   PETS / POUND / INVENTORY
=============================== */

@media (max-width: 900px) {

    .mypets-page,
    .inventory-page {
        max-width: 100%;
        padding: 12px 10px 28px;
    }

    .pets-grid,
    .pound-grid,
    .inventory-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .pet-slot,
    .pet-card,
    .inventory-item {
        width: 100%;
        border-radius: 14px;
    }

    .pet-image,
    .pet-card img {
        width: 110px !important;
        max-width: 100%;
        height: auto;
    }

    .inventory-item-image img {
        width: 68px;
        height: 68px;
    }

    .hub-wrapper {
        max-width: 100%;
        margin: 12px 10px;
        padding: 16px;
        border-radius: 16px;
    }

    .hub-container {
        flex-direction: column;
        align-items: center;
        gap: 18px;
    }

    .hub-card {
        width: 100%;
        min-height: unset;
        text-align: center;
    }

    .hub-image {
        width: 170px;
        margin: 0 auto;
    }
}

@media (max-width: 420px) {

    .pets-grid,
    .pound-grid,
    .inventory-grid {
        grid-template-columns: 1fr;
    }
}

/* ===============================
   GAMES
=============================== */

@media (max-width: 900px) {

    .games-wrapper,
    .games-container {
        padding: 12px 10px 24px;
        max-width: 100%;
    }

    .game-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 14px;
    }

    .game-left {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .game-icon {
        max-width: 90px;
    }

    .game-right {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        text-align: center;
    }
}

/* ===============================
   PROFILE
=============================== */

@media (max-width: 900px) {

    .profile-page .profile-container {
        width: 100%;
        padding: 12px 10px 24px;
    }

    .profile-page .profile-details {
        display: grid !important;
        grid-template-columns: 1fr auto !important;
        align-items: start !important;
        gap: 10px !important;
        padding: 14px !important;
        border-radius: 14px;
    }

    .profile-page .pd-left {
        grid-column: 1 !important;
        width: auto !important;
        min-width: 0 !important;
    }

    .profile-page .pd-row {
        display: flex !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }

    .profile-page .pd-image {
        width: 50px;
        height: 50px;
        border-radius: 12px;
        flex-shrink: 0;
    }

    .profile-page .pd-right {
        grid-column: 2 !important;
        width: auto !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        justify-content: flex-end !important;
        gap: 6px !important;
        margin: 0 !important;
        padding-top: 2px !important;
    }

    .profile-page .pd-right button {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 10px !important;
        font-size: 0 !important;
        overflow: hidden !important;
    }

    .profile-page .pd-right .add-friend-btn::before {
        content: "＋" !important;
        font-size: 18px !important;
        line-height: 1 !important;
    }

    .profile-page .pd-right .message-btn::before {
        content: "💬" !important;
        font-size: 16px !important;
        line-height: 1 !important;
    }

    .profile-page .pd-right > a {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        margin: 0 !important;
        border-radius: 8px !important;
    }

    .profile-page .pd-right > a img {
        width: 16px !important;
        height: 16px !important;
        display: block !important;
        object-fit: contain !important;
    }

    .profile-page .profile-info {
        flex-direction: column;
        gap: 14px;
    }

    .profile-page .info-col,
    .profile-page .post-col {
        width: 100%;
    }

    .profile-page .pet-box {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-page .profile-friends-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    }

    .profile-page .post-container,
    .profile-page .write-post-container {
        padding: 14px;
        border-radius: 18px;
    }
}

@media (max-width: 420px) {

    .profile-page .pet-box {
        grid-template-columns: 1fr;
    }

    .profile-page .profile-friends-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .profile-page .pd-image {
        width: 44px;
        height: 44px;
    }
}

/* ===============================
   SETTINGS
=============================== */

@media (max-width: 900px) {

    .settings-layout {
        grid-template-columns: 1fr;
    }
}

/* ===============================
   LOGIN / REGISTER
=============================== */

@media (max-width: 500px) {

    .auth-box {
        padding: 20px;
    }

    .form-toggle button {
        padding: 8px;
        font-size: 14px;
    }
}

/* ===============================
   CHAT
=============================== */

@media (max-width: 900px) {

    body {
        padding-bottom: 70px;
    }

    #chat-bubble-bar {
        display: none !important;
    }

    #chat-window {
        display: none !important;
    }
}

/* ===============================
   DESKTOP RESET
   Prevent stuck mobile menu on resize
=============================== */

@media (min-width: 901px) {

    body.mobile-menu-open {
        overflow: auto !important;
    }

    .mobile-sidebar-overlay {
        display: none !important;
    }

    .left-sidebar {
        transform: none !important;
    }
}

/* ===============================
   FIX: SMALL DESKTOP / NARROW WINDOW
   Turn sidebar into drawer sooner
=============================== */

@media (max-width: 1100px) {

    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .left-sidebar {
        display: block !important;
        position: fixed !important;
        top: 60px !important;
        left: 0 !important;
        z-index: 2000 !important;

        width: 270px !important;
        max-width: 85vw !important;
        height: calc(100vh - 60px) !important;

        transform: translateX(-105%) !important;
        transition: transform 0.25s ease !important;

        overflow-y: auto !important;
        background: #ffffff !important;
        border-right: 1px solid #e5d7ff !important;
        box-shadow: 8px 0 25px rgba(70, 49, 120, 0.22) !important;
    }

    body.mobile-menu-open .left-sidebar {
        transform: translateX(0) !important;
    }

    .mobile-sidebar-overlay {
        display: none;
        position: fixed;
        inset: 60px 0 0 0;
        z-index: 1500;
        background: rgba(25, 18, 40, 0.45);
    }

    body.mobile-menu-open .mobile-sidebar-overlay {
        display: block;
    }

    .main-content,
    .home-main-content,
    .content-area,
    .page-container,
    main {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .right-sidebar {
        display: none !important;
    }
}