/* ============================================================
   GLOBAL RESPONSIVE STYLESHEET
   Breakpoints: 1440 | 1199 | 991 | 767 | 575 | 480
   ============================================================ */

/* Sidebar offset now lives on .content_area in common.css — no body override needed */

/* ── 1440px: Cap containers ─────────────────────────────── */
@media (max-width: 1440px) {
    .custom_container {
        max-width: 1080px !important;
        padding: 0 20px;
    }
    .page_wrap {
        padding-left: 10px;
        padding-right: 10px;
    }
}

/* ── 1199px: Sidebar collapses, full-width layout ────────── */
@media (max-width: 1199px) {
    /* Header */
    .header_wrap,
    .top_header_wrap {
        padding: 5px 15px;
    }

    /* Sidebar hamburger visible */
    .menu_hamburger,
    .hamburger_btn {
        display: flex !important;
    }

    /* Content area full width — remove sidebar offset, keep header clearance */
    .content_area {
        width: 100%;
        padding-left: 0;
    }

    /* Containers */
    .custom_container {
        max-width: 100% !important;
        padding: 0 15px;
    }

    /* Step layout */
    .step_content {
        padding: 20px 15px;
    }

    .fullrow_top {
        padding: 0 0 15px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .fullrow_btm {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Formarea full width */
    .formarea {
        max-width: 100% !important;
    }

    /* Tables: allow horizontal scroll */
    .table_wrap,
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Grid columns */
    .col-md-6,
    .col-md-4,
    .col-md-3 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    /* Cards / option boxes */
    .common_options {
        flex-wrap: wrap;
        gap: 10px;
    }
    .common_box {
        min-width: 140px;
        flex: 1 1 140px;
    }
}

/* ── 991px: Tablet ───────────────────────────────────────── */
@media (max-width: 991px) {
    /* Typography */
    h3 { font-size: 18px !important; }
    h4 { font-size: 15px !important; }

    /* Containers */
    .custom_container {
        padding: 0 12px;
    }

    /* Step content */
    .step_content {
        padding: 15px 12px;
        min-height: auto;
    }

    .fullrow_top h3 {
        font-size: 17px !important;
    }

    .fullrow_mid {
        padding: 10px 0;
    }

    /* Formarea */
    .formarea {
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Grid: full width columns on tablet */
    .col-md-6,
    .col-md-4,
    .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Buttons */
    .c_btn {
        padding: 10px 18px;
        font-size: 13px;
    }

    /* Cards */
    .common_box {
        flex: 1 1 calc(50% - 10px);
    }

    /* Filter row */
    .filter_row,
    .filterrow_wrap {
        flex-wrap: wrap;
        gap: 8px;
    }
    .filter_row > *,
    .filterrow_wrap > * {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }

    /* Listing table */
    .listing_table th,
    .listing_table td,
    .data_table th,
    .data_table td {
        padding: 10px 8px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* Banner upload */
    .addbanner_btn {
        width: 100%;
        min-height: 80px;
    }

    /* Tag pills */
    .tag_pill,
    .common_options a {
        font-size: 12px;
        padding: 4px 10px;
    }

    /* Prevbtn */
    .prevbtn {
        font-size: 12px;
    }
    .prevbtn .ptext {
        font-size: 12px;
    }

    /* Progress bar */
    .progress_wrap {
        flex: 1 1 100%;
        margin-bottom: 8px;
    }

    /* Tooltip */
    .tooltip_content {
        max-width: 260px !important;
    }
}

/* ── 767px: Mobile landscape / large phone ──────────────── */
@media (max-width: 767px) {
    /* Reduce header clearance for smaller header height on mobile */
    .content_area {
        padding-top: 60px;
        padding-left: 0;
    }

    /* Containers */
    .custom_container {
        padding: 0 10px;
    }

    /* Page wrap */
    .page_wrap {
        padding: 0 0 20px;
    }

    /* Step content */
    .step_content {
        padding: 12px 10px;
        border-radius: 8px;
    }

    .step_content .fullrow_top {
        gap: 6px;
        padding-bottom: 10px;
    }

    .step_content .fullrow_top h3 {
        font-size: 16px !important;
        line-height: 22px;
    }

    /* Prevbtn */
    .prevbtn {
        gap: 4px;
    }

    /* Formarea */
    .formarea {
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* Row grids: all full width on mobile */
    [class*="col-"] {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }

    /* Inputs & textareas */
    .input,
    input[type="text"],
    input[type="email"],
    input[type="url"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    textarea.textarea,
    .textarea {
        font-size: 13px;
        height: auto;
        min-height: 40px;
        padding: 8px 10px;
    }

    textarea.textarea {
        min-height: 100px;
    }

    /* Dropdowns */
    .ui.search.dropdown,
    .ui.selection.dropdown {
        height: auto !important;
        min-height: 40px;
    }

    /* Buttons */
    .c_btn,
    .c_btn.roundshape {
        padding: 9px 16px;
        font-size: 12px;
        min-height: 38px;
    }

    .c_btn .arrow {
        display: none;
    }

    /* fullrow_btm stack vertically */
    .fullrow_btm {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .fullrow_btm .c_btn,
    .fullrow_btm button {
        width: 100%;
        justify-content: center;
    }

    .fullrow_btm .progress_wrap {
        width: 100%;
    }

    /* Option cards: 2 per row */
    .common_options {
        gap: 8px;
    }
    .common_box {
        flex: 1 1 calc(50% - 8px);
        min-width: 120px;
        padding: 10px 8px;
        font-size: 12px;
    }
    .common_box .icon {
        margin-bottom: 6px;
    }

    /* Custom label */
    .custom_label {
        font-size: 12px;
        margin-bottom: 6px;
    }

    /* letter remaining */
    .letter_remaining {
        font-size: 10px;
    }

    /* Banner */
    .addbanner_btn {
        width: 100%;
        height: 80px;
        font-size: 12px;
    }

    /* Tags */
    .new_inputlabel .input {
        font-size: 12px;
    }

    /* Article listing table — horizontal scroll */
    .listing_main_wrap,
    .table_wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .listing_table,
    .data_table {
        min-width: 700px;
    }

    /* Tab bar: scroll horizontally */
    .tab_wrap,
    .tabs_row,
    .filter_tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        white-space: nowrap;
        padding-bottom: 4px;
    }

    /* Filter row: stack */
    .filter_row,
    .filterrow_wrap {
        flex-direction: column;
        gap: 8px;
    }
    .filter_row > *,
    .filterrow_wrap > * {
        width: 100%;
        flex: none;
    }

    /* Modals */
    .custom_modal .modal_inner,
    .modal_wrap .modal_inner {
        width: 95vw;
        max-width: 95vw;
        padding: 20px 15px;
    }

    /* Tooltips */
    .mytooltip .tooltip_content {
        max-width: 200px !important;
        right: 0;
        left: auto;
        transform: none;
    }

    /* Summernote editor */
    .note-editor .note-toolbar {
        flex-wrap: wrap;
    }

    /* Custom label icon */
    .custom_label .icon {
        width: 16px;
        height: 16px;
    }

    /* Search / select in filters */
    .selectsearch_wrap input,
    .dropdownmenu .input {
        height: 34px;
        font-size: 12px;
    }

    /* Progress bar compact */
    .custom_progress {
        height: 4px;
    }

    /* Step numbers / breadcrumb if any */
    .sm_text {
        font-size: 10px;
    }

    /* White box */
    .whitebox {
        padding: 15px;
        border-radius: 8px;
    }

    /* Error msg */
    .error_msg {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* ── 575px: Small phones ─────────────────────────────────── */
@media (max-width: 575px) {
    /* Typography */
    h3 { font-size: 15px !important; }
    h4 { font-size: 13px !important; }

    /* Step content */
    .step_content {
        padding: 10px 8px;
    }

    .fullrow_top h3 {
        font-size: 14px !important;
    }

    /* Option cards: 1 per row on very small */
    .common_box {
        flex: 1 1 100%;
        min-width: 0;
    }

    /* Buttons full width */
    .c_btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* Reduce padding */
    .custom_container {
        padding: 0 8px;
    }

    /* Textarea */
    textarea.textarea {
        min-height: 80px;
    }

    /* Tags: wrap */
    [style*="display: flex"][style*="flexWrap: wrap"] {
        gap: 4px !important;
    }

    /* Summernote: reduce height on mobile */
    .note-editable {
        min-height: 180px !important;
    }

    /* Header title compact */
    .page_title {
        font-size: 12px !important;
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ── 480px: Very small phones ────────────────────────────── */
@media (max-width: 480px) {
    .content_area {
        padding-top: 55px;
    }

    .step_content {
        padding: 8px 6px;
    }

    .custom_container {
        padding: 0 6px;
    }

    /* Input labels */
    .custom_label {
        font-size: 11px;
    }

    /* Buttons */
    .c_btn {
        padding: 8px 12px;
        font-size: 11px;
    }

    /* Listing table min-width tighter */
    .listing_table,
    .data_table {
        min-width: 560px;
    }
}

/* ── Create-article specific ─────────────────────────────── */
@media (max-width: 991px) {
    .step_content.select_geographic .formarea,
    .step_content.select_scope .formarea,
    .step_content.write_options .formarea,
    .step_content.select_category .formarea,
    .step_content.article_type .formarea,
    .step_content.article_format .formarea,
    .step_content.article_prompt .formarea,
    .step_content.meta_details .formarea {
        max-width: 100% !important;
    }

    .step_content .toptext_box {
        margin-bottom: 12px;
    }

    .step_content .toptext_box h4 {
        font-size: 14px;
    }

    .step_content .toptext_box p {
        font-size: 12px;
    }
}

@media (max-width: 767px) {
    /* Geo buttons: stack */
    .step_content.select_geographic .common_options,
    .step_content.write_options .common_options {
        flex-direction: column;
    }

    .step_content .geographic_btn,
    .step_content .mytooltip.common_box {
        width: 100%;
    }

    /* Progress row */
    .step_content .fullrow_btm {
        flex-wrap: wrap;
        gap: 10px;
    }

    .step_content .fullrow_btm .progress_wrap {
        order: -1;
        width: 100%;
    }

    /* Banner area */
    .addbanner_btn {
        min-height: 80px;
        font-size: 12px;
    }

    /* Summary textarea */
    .step_content textarea.textarea[style*="minHeight"] {
        min-height: 160px !important;
    }
}

/* ── Articles listing specific ───────────────────────────── */
@media (max-width: 767px) {
    .articles_listing_wrap .tab_list,
    .articles_listing_wrap .filter_tabs {
        overflow-x: auto;
        white-space: nowrap;
    }

    .articles_listing_wrap .article_row,
    .articles_listing_wrap .lisitng_table_wrap {
        overflow-x: auto;
    }
}

/* ── Dashboard specific ──────────────────────────────────── */
@media (max-width: 991px) {
    .dashboard_wrap .stat_cards,
    .dashboard_wrap .chart_row {
        flex-wrap: wrap;
    }
    .dashboard_wrap .stat_card {
        flex: 1 1 calc(50% - 10px);
    }
}

@media (max-width: 575px) {
    .dashboard_wrap .stat_card {
        flex: 1 1 100%;
    }
}

/* ── Sidebar overlay on mobile ───────────────────────────── */
@media (max-width: 1199px) {
    /* When sidebar is open (menu-sect active), add dark overlay behind content */
    .menu-sect.active ~ .content_area::before,
    .menu-sect:hover ~ .content_area::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.3);
        z-index: 99;
        pointer-events: auto;
    }
}
