/* ==========================================================================
   MOBILE RESPONSIVE STYLES - Flyff Iblis
   Breakpoint: 768px
   ========================================================================== */

/* === BASE MOBILE RESET === */
@media screen and (max-width: 768px) {

    /* Layout Foundation */
    .grid {
        width: 100% !important;
        padding: 0 10px;
        box-sizing: border-box;
    }

    .outer-grid {
        min-width: 100% !important;
        max-width: 100% !important;
    }

    /* Flexbox Layout for Reordering */
    .bg-content {
        display: flex;
        flex-direction: column;
        padding: 10px !important;
    }

    /* Column Layout Conversion */
    .column-right {
        width: 100% !important;
        float: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box;
    }

    /* Make column-left transparent so its children become flex items */
    .column-left {
        display: contents;
    }

    /* Sidebar sections */
    .sidebar-top,
    .sidebar-bottom {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Order: 1. Login/Member panel, 2. Main content, 3. Rest of sidebar */
    .sidebar-top {
        order: 1;
        margin-top: 60px; /* Space for fixed navbar */
    }

    .column-right {
        order: 2;
        margin-top: 15px !important;
        margin-bottom: 15px !important;
    }

    .sidebar-bottom {
        order: 3;
    }

    /* === HERO SECTION === */
    .showx {
        height: auto !important;
        min-height: 100px;
        padding: 10px;
        display: none; /* Hide hero section on mobile for cleaner layout */
    }

    /* Hide decorative banner elements on mobile */
    .text-flyff,
    .text-iblis,
    .characters {
        display: none !important;
    }

    /* === PARALLAX DISABLE === */
    .bgwrap,
    .bgmiddlewrap,
    .bgfrontwrap {
        background-attachment: scroll !important;
        background-position: center top !important;
        background-size: cover !important;
    }

    /* Simplify backgrounds on mobile */
    .bgmiddlewrap,
    .bgfrontwrap {
        background-image: none !important;
    }

    /* === CONTAINER BOXES === */
    .container-box {
        margin-bottom: 10px !important;
        padding: 10px !important;
        width: 100% !important;
    }

    .container-box.col-lg-12,
    .container-box.col-sm-12 {
        width: 100% !important;
        padding: 10px !important;
    }

    /* === SIDEBOX TITLES === */
    .sidebox-title {
        padding: 10px 0 0 60px;
        font-size: 14px;
        height: 42px;
        background-size: auto 42px;
    }

    .sidebox-title2 {
        padding: 6px 0 0 75px;
        font-size: 12px;
        height: 42px;
        background-size: auto 42px;
    }

    /* === DISCORD IFRAME === */
    iframe[src*="discord"] {
        width: 100% !important;
        max-width: 100% !important;
        height: 200px !important;
    }

    /* === FORMS === */
    .form-control {
        width: 100% !important;
        box-sizing: border-box;
        font-size: 16px !important; /* Prevents iOS zoom */
    }

    .inner-content form input[type="text"],
    .inner-content form input[type="password"],
    .inner-content-logged form input[type="text"],
    .inner-content-logged form input[type="password"] {
        width: 100% !important;
        padding: 12px 12px 12px 35px;
        font-size: 16px !important;
        box-sizing: border-box;
    }

    .btn-iblis {
        width: 48% !important;
        margin: 5px 1% !important;
        padding: 12px 10px;
        font-size: 13px;
        display: inline-block;
    }

    .inner-content-logged .btn-iblis {
        width: 100% !important;
        margin: 5px 0 !important;
    }

    /* === TABLES === */
    .table,
    table {
        width: 100% !important;
        font-size: 11px;
    }

    .table > thead > tr > th,
    .table > tbody > tr > td,
    table th,
    table td {
        padding: 5px 3px !important;
    }

    /* Level Up Rewards table */
    .column-left table[border="1"] {
        width: 100% !important;
        font-size: 10px;
    }

    .column-left table[border="1"] td {
        padding: 4px 2px !important;
    }

    .column-left table[border="1"] img {
        width: 24px !important;
        height: 24px !important;
    }

    /* Hide playtime column on mobile for rankings */
    .column-left .table th:nth-child(4),
    .column-left .table td:nth-child(4) {
        display: none;
    }

    /* Job icons */
    .job-icon {
        width: 20px !important;
        height: 18px !important;
        background-size: 180% !important;
    }

    /* === NOTICE/NEWS BOXES === */
    .mini-notice {
        width: 100% !important;
        float: none !important;
        margin: 0 0 15px 0 !important;
        height: auto !important;
    }

    .notice-title h1 {
        font-size: 18px;
    }

    .notice-content {
        padding: 10px;
    }

    .notice-content img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* === FOOTER === */
    .footer-container {
        padding: 15px !important;
        text-align: center;
    }

    .copyright {
        font-size: 11px;
    }
}

/* ==========================================================================
   MOBILE NAVIGATION (Hamburger Menu)
   ========================================================================== */

/* Hamburger button and mobile brand - hidden on desktop, shown on mobile */
@media screen and (min-width: 769px) {
    .navbar-toggle {
        display: none !important;
    }

    .mobile-brand {
        display: none !important;
    }
}

@media screen and (max-width: 768px) {

    /* Navbar container */
    #header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    #header-container {
        position: relative;
        text-align: left !important;
        padding: 0 !important;
        min-height: 50px;
    }

    /* Show hamburger button */
    .navbar-toggle {
        display: block !important;
        float: right;
        margin: 10px 15px;
        padding: 9px 10px;
        background-color: #f8f8f8 !important;
        border: 1px solid #ddd !important;
        border-radius: 4px;
        cursor: pointer;
        z-index: 10000;
        position: relative;
    }

    .navbar-toggle:hover,
    .navbar-toggle:focus {
        background-color: #e8e8e8 !important;
    }

    .navbar-toggle .icon-bar {
        display: block !important;
        width: 22px;
        height: 3px;
        background-color: #333 !important;
        border-radius: 1px;
        margin: 4px 0;
    }

    /* Mobile brand */
    .mobile-brand {
        display: block;
        float: left;
        padding: 12px 15px;
        font-size: 16px;
        font-weight: bold;
        color: #333;
        text-decoration: none;
    }

    .mobile-brand:hover {
        color: #666;
        text-decoration: none;
    }

    /* Hide navbar by default on mobile */
    #navbar {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        background: #fff;
        border-top: 1px solid #eee;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
        max-height: 80vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        z-index: 9998;
        padding: 0 !important;
        margin: 0 !important;
        border-width: 0 !important;
    }

    /* Override Bootstrap navbar-collapse restrictions */
    #navbar.navbar-collapse {
        max-height: none !important;
        height: auto !important;
    }

    .navbar-fixed-top #navbar {
        max-height: 80vh !important;
    }

    #navbar.show {
        display: block !important;
    }

    /* Stack nav items vertically */
    .nav.navbar-nav {
        display: block !important;
        width: 100%;
        margin: 0 !important;
        padding: 0 !important;
        list-style: none;
        float: none !important;
    }

    .nav.navbar-nav > li {
        display: block !important;
        width: 100%;
        float: none !important;
        margin: 0 !important;
        border-bottom: 1px solid #eee;
    }

    .nav.navbar-nav > li > a {
        display: block !important;
        padding: 15px 20px !important;
        text-align: left !important;
        color: #333 !important;
        font-size: 14px;
        line-height: 1.4;
        text-decoration: none;
        background: transparent;
    }

    .nav.navbar-nav > li > a:hover,
    .nav.navbar-nav > li > a:focus {
        background-color: #f5f5f5 !important;
        color: #000 !important;
    }

    .nav.navbar-nav > li.active > a {
        background-color: #e8e8e8 !important;
        color: #333 !important;
    }

    /* Add spacing for fixed navbar */
    body {
        padding-top: 50px;
    }
}

/* Desktop: ensure navbar is visible */
@media screen and (min-width: 769px) {
    #navbar {
        display: block !important;
    }

    .nav.navbar-nav {
        display: inline-table !important;
    }
}

/* ==========================================================================
   COLLAPSIBLE PANELS (Mobile Only)
   ========================================================================== */

/* Collapse icon - hidden on desktop */
.collapse-icon {
    display: none;
}

@media screen and (max-width: 768px) {

    .collapsible-header {
        cursor: pointer;
        position: relative;
        user-select: none;
    }

    .collapsible-header:active {
        opacity: 0.8;
    }

    .collapse-icon {
        display: block;
        position: absolute;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 18px;
        font-weight: bold;
        color: #666;
        width: 24px;
        height: 24px;
        line-height: 24px;
        text-align: center;
        background: rgba(255,255,255,0.8);
        border-radius: 3px;
    }

    .collapsible-header.expanded .collapse-icon {
        content: '-';
    }

    .collapsible-content {
        display: none;
        overflow: hidden;
    }

    .collapsible-content.show {
        display: block;
    }

    /* Ensure login panel content is ALWAYS visible */
    #login-panel .collapsible-content,
    #member-panel .collapsible-content,
    .login-always-visible {
        display: block !important;
    }
}

/* Desktop: always show collapsible content */
@media screen and (min-width: 769px) {
    .collapsible-content {
        display: block !important;
    }
}

/* ==========================================================================
   VERY SMALL SCREENS (480px and below)
   ========================================================================== */

@media screen and (max-width: 480px) {

    .sidebox-title {
        font-size: 12px;
        padding-left: 50px;
    }

    .sidebox-title2 {
        font-size: 10px;
        padding-left: 65px;
    }

    .btn-iblis {
        width: 100% !important;
        margin: 5px 0 !important;
    }

    .column-left table[border="1"] {
        font-size: 9px;
    }

    .column-left table[border="1"] img {
        width: 20px !important;
        height: 20px !important;
    }

    .table {
        font-size: 10px;
    }

    .notice-title h1 {
        font-size: 16px;
    }
}
