/* =========================================
   RESPONSIVE PANEL
   Mobile / Tablet
========================================= */

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* ---------- Main Layout ---------- */

.layout {
    width: 100%;
    min-height: 100vh;
}

.main-content {
    min-width: 0;
    max-width: 100%;
}

/* ---------- Tables ---------- */

.admin-section {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}


/* =========================================
   TABLET
========================================= */

@media (max-width: 900px) {

    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        min-height: auto;
        position: static;

        display: flex;
        flex-wrap: wrap;
        align-items: center;

        gap: 8px;
        padding: 12px 15px;
    }

    .sidebar h3 {
        width: 100%;
        margin: 0 0 5px 0;
    }

    .sidebar .user {
        width: 100%;
        margin: 0 0 5px 0;
    }

    .sidebar a {
        display: inline-flex;
        align-items: center;
        justify-content: center;

        margin: 0;
        padding: 9px 12px;

        font-size: 14px;
    }

    .main-content {
        width: 100%;
        max-width: 100%;
        padding: 20px 15px;

        overflow-x: hidden;
    }

    /* grids */

    .stats-grid,
    .admin-stats,
    .plan-summary,
    .pricing-grid,
    .trust-grid,
    .compare-grid,
    .diff-grid,
    .output-grid,
    .solution-steps {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 15px;
        width: 100%;
    }

    .stat-card,
    .plan-item,
    .price-card,
    .trust-card,
    .compare-card,
    .diff-item,
    .output-card,
    .step-card {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* forms */

    form {
        max-width: 100%;
    }

    input,
    select,
    textarea {
        max-width: 100%;
    }

    /* history */

    .history-card {
        width: 100%;
        max-width: 100%;
    }

    .history-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .content-badges {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* support */

    .support-container {
        width: 100%;
    }

    /* admin table */

    .admin-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;

        -webkit-overflow-scrolling: touch;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
}


/* =========================================
   MOBILE
========================================= */

@media (max-width: 600px) {

    body {
        font-size: 14px;
    }

    .layout {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    /* ---------- Sidebar ---------- */

    .sidebar {
        width: 100%;
        padding: 10px;
        gap: 6px;

        position: static;

        display: flex;
        flex-wrap: wrap;
    }

    .sidebar h3 {
        width: 100%;
        font-size: 16px;
        text-align: center;
        margin: 0;
        padding: 5px 0;
    }

    .sidebar .user {
        width: 100%;
        text-align: center;
        font-size: 13px;
        margin: 0 0 5px 0;
    }

    .sidebar a {
        flex: 1 1 calc(50% - 6px);

        min-width: 0;

        padding: 9px 6px;

        font-size: 12px;
        text-align: center;

        border-radius: 8px;
    }


    /* ---------- Main Content ---------- */

    .main-content {
        width: 100%;
        max-width: 100%;

        padding: 15px 10px;

        overflow-x: hidden;
    }


    /* ---------- Headings ---------- */

    h1 {
        font-size: 22px;
        line-height: 1.5;
    }

    h2 {
        font-size: 19px;
        line-height: 1.5;
    }

    h3 {
        font-size: 17px;
        line-height: 1.5;
    }


    /* ---------- Grids ---------- */

    .stats-grid,
    .admin-stats,
    .plan-summary,
    .pricing-grid,
    .trust-grid,
    .compare-grid,
    .diff-grid,
    .output-grid,
    .solution-steps {
        display: flex !important;
        flex-direction: column !important;

        width: 100% !important;
        gap: 10px;
    }

    .stat-card,
    .plan-item,
    .price-card,
    .trust-card,
    .compare-card,
    .diff-item,
    .output-card,
    .step-card {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;

        margin: 0;
    }


    /* ---------- Forms ---------- */

    form {
        width: 100%;
        max-width: 100%;
        padding: 15px !important;
    }

    label {
        display: block;
        margin-bottom: 6px;
        font-size: 13px;
    }

    input,
    select,
    textarea {
        width: 100% !important;
        max-width: 100% !important;

        min-height: 42px;

        font-size: 14px;

        padding: 10px;
    }

    textarea {
        min-height: 110px;
    }


    /* ---------- Buttons ---------- */

    button {
        max-width: 100%;
    }

    .btn-new-content,
    .search-btn,
    .clear-search,
    .save-btn,
    .cancel-btn,
    .support-btn,
    .price-btn {
        width: 100%;
        margin: 5px 0;
        text-align: center;
    }

    .copy-btn {
        width: auto !important;
        min-width: 42px;

        display: inline-flex;

        align-items: center;
        justify-content: center;
    }


    /* ---------- Admin ---------- */

    .admin-dashboard {
        width: 100%;
    }

    .admin-header {
        width: 100%;
    }

    .admin-header h1 {
        font-size: 21px;
    }

    .admin-header p {
        font-size: 12px;
    }

    .admin-section {
        width: 100%;
        margin-top: 15px;
    }

    .admin-section h2 {
        font-size: 17px;
    }

    .admin-table {
        display: block;

        width: 100%;

        overflow-x: auto;
        overflow-y: hidden;

        white-space: nowrap;

        -webkit-overflow-scrolling: touch;
    }

    .admin-table th,
    .admin-table td {
        font-size: 12px;
        padding: 9px 10px;
    }

    .plan-form {
        display: flex;
        flex-direction: column;
        gap: 6px;

        min-width: 110px;
    }

    .plan-select,
    .plan-save-btn {
        width: 100% !important;
    }


    /* ---------- History ---------- */

    .history-toolbar {
        display: flex;
        flex-direction: column;

        gap: 10px;

        width: 100%;
    }

    .history-toolbar h2 {
        margin: 0;
    }

    .history-card {
        width: 100%;
        max-width: 100%;

        padding: 12px;
        margin-bottom: 12px;

        overflow: hidden;
    }

    .history-card-header {
        display: flex;
        flex-direction: column;
        align-items: flex-start;

        gap: 10px;
    }

    .history-card-body {
        width: 100%;
    }

    .field-group {
        width: 100%;

        display: block;

        margin-bottom: 12px;

        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .field-label {
        display: block;
        margin-bottom: 5px;
        font-size: 13px;
    }

    .field-value {
        display: block;

        width: 100%;

        overflow-wrap: anywhere;
        word-break: break-word;
        white-space: normal;
    }

    .caption-text,
    .reel-scenario {
        white-space: pre-wrap;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .history-card-actions {
        display: flex;
        flex-direction: column;

        gap: 7px;

        width: 100%;
    }

    .history-card-actions a {
        width: 100%;
        text-align: center;
    }


    /* ---------- Search ---------- */

    .search-form {
        display: flex;
        flex-direction: column;

        gap: 7px;

        width: 100%;
    }

    .search-input,
    .search-btn,
    .clear-search {
        width: 100% !important;
        max-width: 100%;
    }


    /* ---------- Latest Content ---------- */

    .latest-card {
        width: 100%;
        max-width: 100%;

        padding: 15px;

        overflow: hidden;
    }

    .latest-card p,
    .latest-card pre {
        max-width: 100%;

        overflow-wrap: anywhere;
        word-break: break-word;
        white-space: pre-wrap;
    }


    /* ---------- Support ---------- */

    .support-container {
        display: flex;
        flex-direction: column;

        width: 100%;
        gap: 12px;
    }

    .support-form,
    .support-faq,
    .support-tickets {
        width: 100%;
        max-width: 100%;

        padding: 15px;
    }

    .ticket-item {
        width: 100%;

        padding: 12px 0;

        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .ticket-header {
        display: flex;
        flex-direction: column;

        align-items: flex-start;

        gap: 6px;
    }

    .ticket-header strong {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .ticket-replies {
        width: 100%;

        overflow-wrap: anywhere;
        word-break: break-word;
    }


    /* ---------- Flash / Toast ---------- */

    .flash-message,
    .custom-toast {
        max-width: calc(100% - 20px);
        left: 10px;
        right: 10px;
    }


    /* ---------- Prevent long text ---------- */

    p,
    span,
    div,
    td,
    th {
        overflow-wrap: anywhere;
    }

}