/* ==========================================================================
   Mobile styles for Jednosc32 football theme
   Applied at max-width: 768px — loaded after style.css to override desktop
   ========================================================================== */

/* Hamburger hidden by default (desktop) */
.hamburger {
    display: none;
}

/* Desktop fix: after swapping #sidebar before #left in index.php HTML,
   we need sidebar to float right on desktop to maintain original layout */
@media (min-width: 769px) {
    #content {
        display: block;
    }
    #sidebar {
        float: right;
    }
    #left {
        float: left;
    }
    #sidebar-extra {
        float: right;
        clear: right;
        width: 305px;
        margin: 0 0 0 10px;
    }
    #sidebar-extra .widget {
        width: 300px;
        margin: 0 0 10px 5px;
        background: #fff;
        position: relative;
    }
}

/* ==========================================================================
   Mobile: max-width 768px
   ========================================================================== */
@media (max-width: 768px) {

    /* Layout
       ====================================================================== */
    html, body {
        overflow-x: hidden;
    }

    * {
        box-sizing: border-box;
    }

    #all {
        min-width: 0;
        width: 100%;
        overflow-x: hidden;
        background: none;
    }

    #all > div {
        width: 100%;
        max-width: 100%;
    }

    #content {
        width: auto;
        max-width: 100%;
        overflow: visible;
    }

    #left {
        width: auto;
        max-width: 100%;
        float: none;
        margin: 0;
    }

    #sidebar {
        width: auto;
        max-width: 100%;
        float: none;
        margin: 15px 0 0;
    }

    #sidebar-extra {
        width: auto;
        max-width: 100%;
        float: none;
        margin: 0;
    }

    #sidebar-extra .widget {
        width: auto;
        margin: 0 5px 10px;
        box-sizing: border-box;
    }

    #one_column {
        width: auto;
        margin: 0 5px;
    }

    /* Header
       ====================================================================== */
    #top {
        width: 100%;
        height: auto;
        background-image: none;
    }

    #top .logo {
        width: auto;
        height: 70px;
        float: none;
        margin: 10px 0 0 15px;
    }

    #top .logo a {
        width: 240px;
        height: 70px;
        background-size: contain;
    }

    /* Hamburger button */
    .hamburger {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        background: #0077c0;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        padding: 8px;
        z-index: 100;
    }

    .hamburger span,
    .hamburger span::before,
    .hamburger span::after {
        display: block;
        width: 24px;
        height: 3px;
        background: #fff;
        border-radius: 2px;
        position: relative;
        transition: all 0.3s ease;
    }

    .hamburger span::before,
    .hamburger span::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .hamburger span::before {
        top: -8px;
    }

    .hamburger span::after {
        top: 8px;
    }

    /* Hamburger animation when menu is open */
    #top.menu-open .hamburger span {
        background: transparent;
    }

    #top.menu-open .hamburger span::before {
        top: 0;
        transform: rotate(45deg);
    }

    #top.menu-open .hamburger span::after {
        top: 0;
        transform: rotate(-45deg);
    }

    /* Navigation
       ====================================================================== */
    #top {
        position: relative;
    }

    #top .menu {
        display: none;
        width: 100%;
        height: auto;
        margin: 10px 0 0;
        float: none;
        clear: both;
    }

    #top.menu-open .menu {
        display: block;
    }

    #top .menu ul {
        width: 100%;
    }

    #top .menu ul li {
        float: none;
        display: block;
        background: none;
    }

    #top .menu ul li a {
        float: none;
        display: block;
        height: auto;
        line-height: 44px;
        margin: 0;
        padding: 0 15px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    #top .menu ul li.home a {
        background-position: center;
        width: auto;
        text-indent: -9999px;
    }

    #top .menu ul li.rozw a {
        background: none;
        padding: 0 15px;
        margin: 0;
    }

    /* Submenus — show inline on mobile */
    #top .menu ul ul {
        position: static;
        display: none;
        top: auto;
    }

    #top .menu ul li.act ul {
        display: block;
    }

    #top .menu ul li.rozw ul li a {
        width: auto;
        padding-left: 30px;
        background: rgba(0, 0, 0, 0.15);
    }

    #top .menu ul li.rozw ul ul {
        position: static;
        display: none;
        border-left: 0;
    }

    #top .menu ul li.rozw ul li.rozw2 a {
        background: rgba(0, 0, 0, 0.15);
    }

    #top .menu ul li.rozw ul li.rozw2 ul li a {
        padding-left: 45px;
        background: rgba(0, 0, 0, 0.25);
        width: auto;
    }

    /* Sidebar widgets (matches, table)
       ====================================================================== */
    #sidebar .widget {
        width: auto;
        margin: 0 5px 10px;
        box-sizing: border-box;
    }

    /* Matches side by side */
    .matches-row {
        display: flex;
        gap: 5px;
        margin: 0 5px 10px;
    }

    .matches-row .widget-match {
        flex: 1 1 0;
        margin: 0 !important;
    }

    .matches-row .widget-match h2 {
        font-size: 13px;
        line-height: 24px;
        padding: 0 8px 0 10px;
    }

    .matches-row .widget-match .mtch {
        position: relative;
        overflow: hidden;
        display: block;
        padding: 10px 4px 5px;
        text-align: center;
    }

    .matches-row .widget-match .mtch .tm {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        opacity: 0.25;
        float: none;
        width: auto;
    }

    .matches-row .widget-match .mtch .tm:first-child {
        left: 0;
        margin-left: -30px;
    }

    .matches-row .widget-match .mtch .tm:last-child {
        right: 0;
        margin-right: -30px;
    }

    .matches-row .widget-match .mtch .tm img {
        max-width: 80px;
        height: auto;
    }

    .matches-row .widget-match .mtch .sc {
        position: relative;
        z-index: 1;
        width: auto;
        float: none;
        font-size: 11px;
        text-align: center;
    }

    .matches-row .widget-match .mtchinfo {
        font-size: 0;
        padding: 0 4px 5px;
    }

    /* All match info on mobile: stadium on new line */
    #sidebar .widget .mtchinfo {
        font-size: 0;
    }

    #sidebar .widget .mtchinfo span {
        font-size: 11px;
    }

    #sidebar .widget .mtchinfo span + span::before {
        content: " | ";
    }

    #sidebar .widget .mtchinfo a {
        font-size: 11px;
        display: block;
        margin-top: -6px;
    }

    .matches-row .widget-match .season_end {
        padding: 40px 10px;
        text-align: center;
        font-size: 13px;
        color: #999;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    #sidebar .widget .mtch {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        padding: 15px 10px 8px;
    }

    #sidebar .widget .mtch .tm {
        width: auto;
        float: none;
        flex: 0 0 auto;
        min-width: 0;
        order: -1;
    }

    #sidebar .widget .mtch .tm img {
        max-width: unset;
        height: 75px;
    }

    #sidebar .widget .mtch .sc {
        width: auto;
        float: none;
        flex: 0 0 auto;
        min-width: auto;
    }

    #sidebar .widget .tbl {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #sidebar .widget .tbl table {
        width: 100%;
        table-layout: auto;
    }

    #sidebar .widget .tbl td.name {
        width: auto;
    }

    #sidebar .switcher {
        width: auto;
        height: auto;
        box-sizing: border-box;
    }

    /* Slider (hero news)
       ====================================================================== */
    #left .slider {
        width: auto;
        height: auto;
        margin: 5px;
        overflow: hidden;
    }

    #left .slider img {
        width: 100%;
        height: auto;
        display: block;
    }

    #left .slider .desc {
        position: static;
        width: auto;
        background: #0077c0;
    }

    #left .slider .desc h2 {
        margin: 0;
        float: none;
        line-height: 1.3;
        padding: 8px 10px;
        font-size: 16px;
    }

    #left .slider .desc p {
        padding: 5px 10px;
    }

    #left .slider .desc .date {
        margin: 0 0 0 10px;
    }

    #left .slider .desc a.more {
        margin: 0 10px 8px 0;
    }

    /* News items
       ====================================================================== */
    #left .news {
        width: auto;
        float: none;
        margin: 15px 5px 5px;
    }

    #left .news:nth-of-type(even) {
        clear: none;
        margin: 15px 5px 5px;
    }

    .news .photo img {
        width: 100%;
        height: auto;
    }

    #left .news_plywacy {
        width: auto;
        margin: 15px 10px;
    }

    /* One column news */
    #one_column .news {
        width: auto;
        float: none;
        margin: 15px 5px 5px;
    }

    #one_column .news:nth-of-type(3n),
    #one_column .news:nth-of-type(3n+1) {
        clear: none;
        margin: 15px 5px 5px;
    }

    /* Newsp layout */
    #left.newsp .news:nth-of-type(even),
    #left.newsp .news:nth-of-type(odd) {
        clear: none;
    }

    /* Content area / subpages
       ====================================================================== */
    #left .lct {
        width: auto;
        padding: 5px 5px 10px;
        box-sizing: border-box;
    }

    #left .lct .player_foto {
        float: none;
        max-width: 100%;
        margin: 0 auto 15px;
        display: block;
        text-align: center;
    }

    #left .lct .player_foto img {
        max-width: 100%;
        height: auto;
    }

    /* Tables — responsive horizontal scroll */
    #left table.team,
    #left table.sztab,
    #left table.table,
    table.rekordy {
        width: 100%;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #left table td,
    #left table th {
        padding: 5px;
        font-size: 11px;
    }

    /* Terminarz — compact on mobile */
    #left table.terminarz .terminarz-team {
        display: flex;
        align-items: center;
        gap: 6px;
        line-height: 1;
    }

    #left table.terminarz tr td:last-child .terminarz-team {
        justify-content: flex-end;
    }

    #left table.terminarz {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        table-layout: fixed;
    }

    #left table.terminarz thead {
        display: none;
    }

    #left table.terminarz tr td:first-child {
        width: 40px;
        font-size: 10px;
        line-height: 1.2;
    }

    #left table.terminarz tr td + td {
        width: auto;
    }

    #left table.terminarz tr td + td + td {
        width: 40px;
        text-align: center;
    }

    #left table.terminarz tr td + td + td + td {
        width: auto;
    }

    /* Terminarz — collapsible matchdays */
    h3.kolejka-header.kolejka-past {
        cursor: pointer;
        position: relative;
        padding-right: 25px;
        opacity: 0.6;
    }

    h3.kolejka-header.kolejka-past::after {
        content: "▸";
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 14px;
        transition: transform 0.2s;
    }

    h3.kolejka-header.kolejka-past.kolejka-open::after {
        transform: translateY(-50%) rotate(90deg);
    }

    table.terminarz.kolejka-past {
        display: none;
    }

    table.terminarz.kolejka-past.kolejka-open {
        display: table;
    }

    /* Images in content */
    #left .lct img,
    #one_column img {
        max-width: 100%;
        height: auto;
    }

    .alignright,
    .alignleft {
        float: none;
        display: block;
        margin: 10px auto;
    }

    /* Galleries */
    .gallery-item {
        width: 33.33% !important;
    }

    /* Ads / partners
       ====================================================================== */
    #ads {
        width: auto;
        margin: 15px 5px 0;
        padding: 10px;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    #ads .adsheader {
        width: 100%;
        text-align: center;
    }

    #ads img {
        max-height: 40px;
    }

    /* Footer
       ====================================================================== */
    #footer {
        width: auto;
        margin: 5px 5px 0;
        text-align: center;
    }

    #footer .left {
        float: none;
        background-position: center top;
        padding: 40px 0 5px;
        text-align: center;
    }

    #footer .right {
        float: none;
        margin: 5px 0;
    }

    /* Plywacy footer */
    .foot-plywacy {
        width: auto;
        margin: 5px 5px 0;
    }

    .foot-plywacy .fpbox {
        float: none;
        width: auto;
    }

    /* Field visualization */
    .field-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Facebook widget */
    #sidebar .widget.fb-wg {
        overflow: hidden;
    }

    #sidebar .widget.fb-wg .fb-like-box,
    #sidebar .widget.fb-wg .fb-page {
        max-width: 100%;
    }

    /* Notread badge */
    .notread:before {
        font-size: 10px;
        padding: 1px 6px;
    }

    /* Pagination */
    .pagination {
        text-align: center;
        padding: 10px 5px;
    }
}
