﻿/* =====================================================================
   DSP Software Solutions - Responsive Styles
   Mobile / Tablet / Desktop breakpoints
   ===================================================================== */

/* ===================== RESET & BASE ===================== */
html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

img {
    max-width: 100%;
    height: auto;
}

/* ===================== TABLET (max-width: 1024px) ===================== */
@media (max-width: 1024px) {
    .dsp-kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 12px;
    }

    .dsp-grid-2 {
        grid-template-columns: 1fr;
    }

    .dsp-content {
        padding: 18px 18px 40px;
    }
}

/* ===================== MOBILE (max-width: 768px) ===================== */
@media (max-width: 768px) {
    /* ---- BASE ---- */
    body {
        overflow-x: hidden;
        font-size: 14px;
    }

    /* ---- LAYOUT ---- */
    .dsp-app {
        flex-direction: column;
        min-height: 100vh;
    }

    .dsp-sidebar {
        width: 280px;
        max-width: 85vw;
        z-index: 10000;
    }

    .dsp-main {
        margin-left: 0 !important;
        width: 100%;
        max-width: 100%;
    }

    .dsp-content {
        padding: 14px 12px 50px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .dsp-header {
        height: auto;
        min-height: 54px;
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 4px;
        position: sticky;
        top: 0;
        z-index: 999;
    }

    .dsp-header h1 {
        font-size: 15px;
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .dsp-header .crumb {
        font-size: 11px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 40vw;
    }

    .dsp-header .right {
        gap: 8px;
    }

    .dsp-header .user {
        font-size: 12px;
    }

    .dsp-header .user .avatar {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .dsp-toggle {
        display: inline-flex;
        font-size: 22px;
        padding: 6px;
    }

    /* ---- SIDEBAR OVERLAY ---- */
    .dsp-sidebar.open ~ .dsp-main::before {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.6);
        z-index: 9999;
    }

    .dsp-sidebar .dsp-brand {
        padding: 14px 14px;
    }

    .dsp-sidebar .dsp-brand img {
        width: 32px;
        height: 32px;
    }

    .dsp-sidebar .dsp-brand .name {
        font-size: 13px;
    }

    .dsp-nav li > a {
        padding: 10px 14px;
        font-size: 13px;
    }

    .dsp-nav .nav-section {
        padding: 12px 14px 4px;
        font-size: 10px;
    }

    /* ---- FORMS ---- */
    .dsp-form-row {
        display: block !important;
        grid-template-columns: none !important;
    }

    .dsp-form-row > * {
        margin-bottom: 10px;
        width: 100%;
    }

    .dsp-input,
    .dsp-select,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="datetime"],
    input[type="url"],
    select,
    textarea,
    .form-control {
        width: 100% !important;
        max-width: 100% !important;
        font-size: 15px !important;
        padding: 10px 12px !important;
        height: auto !important;
        box-sizing: border-box;
    }

    .dsp-label,
    label {
        font-size: 12px;
        margin-bottom: 4px;
    }

    /* ---- BUTTONS ---- */
    .btn-dsp,
    button,
    input[type="submit"],
    input[type="button"],
    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    .btn-warning,
    .btn-info {
        width: 100%;
        min-height: 42px;
        font-size: 14px;
        padding: 10px 16px;
        margin-bottom: 8px;
        white-space: normal;
        word-break: break-word;
    }

    .btn-dsp-ghost {
        width: 100%;
    }

    /* Inline/grouped buttons - allow side by side */
    .btn-group,
    .button-group,
    .action-buttons,
    [class*="btn-group"],
    [class*="button-group"] {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .btn-group .btn-dsp,
    .btn-group button,
    .btn-group input[type="submit"],
    .btn-group input[type="button"],
    .button-group .btn-dsp,
    .button-group button {
        flex: 1;
        min-width: 0;
    }

    /* ---- TABLES ---- */
    .dsp-table,
    table,
    .grid-view,
    .GridView,
    table[id*="gv"],
    table[id*="GridView"],
    table[id*="grid"],
    table[id*="Grid"],
    table[class*="grid"],
    table[class*="Grid"],
    table[class*="table"],
    table[class*="Table"] {
        display: block;
        width: 100% !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .dsp-table thead th,
    .dsp-table tbody td {
        padding: 8px 10px;
        font-size: 11.5px;
    }

    .dsp-table thead th {
        font-size: 10.5px;
    }

    .table-responsive-wrap,
    .grid-responsive,
    .table-wrapper,
    .grid-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 14px;
    }

    /* ---- CARDS & PANELS ---- */
    .dsp-kpi-grid {
        grid-template-columns: 1fr !important;
        gap: 10px;
    }

    .dsp-kpi {
        padding: 14px 16px;
    }

    .dsp-kpi .kpi-value {
        font-size: 22px;
    }

    .dsp-kpi .kpi-icon {
        width: 32px;
        height: 32px;
        font-size: 15px;
        top: 14px;
        right: 14px;
    }

    .dsp-panel {
        margin-bottom: 14px;
    }

    .dsp-panel-head {
        padding: 12px 14px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .dsp-panel-head h3 {
        font-size: 13px;
    }

    .dsp-panel-body {
        padding: 14px;
    }

    .card,
    .dashboard-card,
    .panel,
    .widget,
    .box {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 14px;
    }

    /* ---- GRID LAYOUTS ---- */
    .row,
    .form-row,
    .dsp-grid-2,
    .dsp-grid-3,
    .dsp-grid-4,
    [class*="grid-"],
    [class*="row-"] {
        display: block !important;
        grid-template-columns: none !important;
    }

    .col,
    .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
    .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
    .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6,
    .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12,
    .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
    .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12,
    .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
    .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12,
    .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6,
    .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        margin-bottom: 12px;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    .container,
    .container-fluid,
    .main-content,
    .content-wrapper,
    .wrapper {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
        box-sizing: border-box;
    }

    /* ---- FILTER BARS ---- */
    .filter-row,
    .filter-bar,
    .search-bar,
    .toolbar,
    [class*="filter-"],
    [class*="search-"],
    [class*="toolbar-"] {
        flex-direction: column !important;
        display: flex !important;
        gap: 8px;
    }

    .filter-row > *,
    .filter-bar > *,
    .search-bar > *,
    .toolbar > * {
        width: 100%;
    }

    /* ---- STATUS BADGES ---- */
    .badge-dsp,
    .badge {
        font-size: 10px;
        padding: 2px 8px;
    }

    /* ---- MODAL ---- */
    .dsp-modal {
        width: 94% !important;
        max-width: 94% !important;
        margin: 0 auto;
        border-radius: 16px;
    }

    .dsp-modal-header {
        padding: 24px 20px 0 !important;
    }

    .dsp-modal-header .dsp-modal-icon {
        width: 52px !important;
        height: 52px !important;
        font-size: 22px !important;
    }

    .dsp-modal-header h3 {
        font-size: 18px !important;
    }

    .dsp-modal-body {
        padding: 10px 20px 16px !important;
    }

    .dsp-modal-body p {
        font-size: 13px !important;
    }

    .dsp-modal-footer {
        padding: 0 20px 20px !important;
        flex-direction: column !important;
    }

    .dsp-modal-btn {
        width: 100% !important;
        padding: 14px !important;
    }

    /* ---- PROGRESS BARS ---- */
    .dsp-progress {
        height: 6px;
    }

    /* ---- LIST GROUP ---- */
    .dsp-list li {
        padding: 10px 12px;
        gap: 10px;
    }

    .dsp-list .ico {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }

    .dsp-list .body .t {
        font-size: 12.5px;
    }

    .dsp-list .body .s {
        font-size: 11px;
    }

    /* ---- CHART CONTAINERS ---- */
    .chart-wrap {
        height: 220px;
    }

    .chart-wrap-sm {
        height: 160px;
    }

    /* ---- FOOTER ---- */
    .dsp-footer {
        font-size: 10.5px;
        padding: 10px;
        line-height: 1.6;
    }

    /* ---- INVOICE VIEW (webInvoiceView.aspx) ---- */
    #printArea {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px !important;
    }

    #printArea table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* ---- LOGIN PAGES ---- */
    .login-container,
    .login-box,
    .login-form,
    .login-panel,
    [class*="login-"] {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px !important;
        margin: 10px !important;
    }

    /* ---- INDEX PAGE (landing) ---- */
    .hero-section,
    .hero-content,
    .hero-text {
        padding: 20px 12px !important;
    }

    .hero-section h1 {
        font-size: 22px !important;
    }

    .hero-section p {
        font-size: 14px !important;
    }

    /* ---- PAGE-SPECIFIC OVERRIDES ---- */
    /* webPendingJobs.aspx - job cards */
    .job-card,
    .pending-job-card,
    .ticket-card,
    [class*="job-card"],
    [class*="ticket-card"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* webTicketDetails.aspx - discussion area */
    .discussion-item,
    .discussion-card,
    .timeline-item {
        width: 100%;
        box-sizing: border-box;
    }

    /* webClientCreateTicket.aspx - ticket form */
    .ticket-form,
    .create-ticket-form {
        width: 100%;
    }

    .tf {
        width: 100%;
    }

    .tf .dsp-input,
    .tf .dsp-select {
        width: 100%;
    }

    .file-upload-row {
        flex-direction: column;
        gap: 8px;
    }

    .file-upload-row > * {
        width: 100%;
    }

    /* webClientDashboard.aspx */
    .dashboard-stats {
        grid-template-columns: 1fr !important;
    }

    /* ---- TABS ---- */
    .nav-tabs,
    .tab-menu,
    [class*="tab-"] {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .nav-tabs > li,
    .tab-menu > li,
    [class*="tab-"] > li {
        flex: 1 1 auto;
        min-width: 0;
    }

    .nav-tabs > li > a,
    .tab-menu > li > a {
        font-size: 12px;
        padding: 8px 10px;
        text-align: center;
    }

    /* ---- PAGINATION ---- */
    .pagination,
    .pager {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
    }

    .pagination li,
    .pager li {
        flex: 0 0 auto;
    }

    /* ---- ALERTS / MESSAGES ---- */
    .alert,
    .message,
    .notification,
    .dsp-msg,
    [class*="alert-"],
    [class*="msg-"],
    [class*="message-"] {
        width: 100% !important;
        box-sizing: border-box;
        padding: 10px 12px !important;
        font-size: 13px;
    }

    /* ---- CHECKBOXES / RADIOS ---- */
    input[type="checkbox"],
    input[type="radio"] {
        width: auto !important;
        min-height: auto !important;
        transform: scale(1.2);
        margin-right: 6px;
    }

    /* ---- HIDE DESKTOP-ONLY ELEMENTS ---- */
    .desktop-only,
    .hide-mobile {
        display: none !important;
    }

    /* ---- SHOW MOBILE-ONLY ELEMENTS ---- */
    .mobile-only {
        display: block !important;
    }

    /* ---- FLEX HELPERS ---- */
    .flex-between {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px;
    }

    .flex-between > * {
        width: 100%;
    }
}

/* ===================== SMALL MOBILE (max-width: 480px) ===================== */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    .dsp-content {
        padding: 10px 8px 40px;
    }

    .dsp-header {
        padding: 6px 8px;
        min-height: 48px;
    }

    .dsp-header h1 {
        font-size: 14px;
    }

    .dsp-header .crumb {
        font-size: 10px;
        max-width: 30vw;
    }

    .dsp-kpi .kpi-value {
        font-size: 20px;
    }

    .dsp-panel-head {
        padding: 10px 12px;
    }

    .dsp-panel-head h3 {
        font-size: 12px;
    }

    .dsp-panel-body {
        padding: 10px;
    }

    .dsp-table thead th,
    .dsp-table tbody td {
        padding: 6px 8px;
        font-size: 11px;
    }

    .dsp-input,
    .dsp-select,
    input,
    select,
    textarea,
    .form-control {
        font-size: 14px !important;
        padding: 8px 10px !important;
    }

    .btn-dsp,
    button,
    input[type="submit"],
    input[type="button"],
    .btn {
        min-height: 38px;
        font-size: 13px;
        padding: 8px 14px;
    }
}

/* ===================== PRINT / PDF ===================== */
@media print {
    html, body {
        overflow: visible !important;
        background: #fff !important;
        color: #000 !important;
        font-size: 12px;
    }

    .dsp-sidebar,
    .dsp-header,
    .dsp-toggle,
    .dsp-footer,
    .btn-dsp,
    button,
    input[type="submit"],
    input[type="button"],
    .btn,
    .no-print,
    .dsp-modal-overlay {
        display: none !important;
    }

    .dsp-app {
        display: block !important;
        min-height: auto !important;
    }

    .dsp-main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .dsp-content {
        padding: 0 !important;
        overflow: visible !important;
    }

    .dsp-panel {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .dsp-table {
        display: table !important;
        width: 100% !important;
        overflow: visible !important;
        white-space: normal !important;
    }

    .dsp-table thead th {
        background: #f5f5f5 !important;
        color: #000 !important;
        border-bottom: 2px solid #ddd !important;
    }

    .dsp-table tbody td {
        color: #000 !important;
        border-bottom: 1px solid #eee !important;
    }

    .dsp-table,
    table,
    .grid-view,
    .GridView,
    table[id*="gv"],
    table[id*="GridView"],
    table[id*="grid"],
    table[class*="grid"],
    table[class*="table"] {
        display: table !important;
        overflow: visible !important;
        white-space: normal !important;
    }

    #printArea {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    #printArea table {
        display: table !important;
        overflow: visible !important;
        white-space: normal !important;
    }

    .dsp-kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    }

    .row,
    .form-row,
    .dsp-grid-2,
    .dsp-grid-3,
    .dsp-grid-4,
    [class*="grid-"] {
        display: flex !important;
    }

    .col,
    .col-md-6,
    .col-md-4,
    .col-md-3,
    .col-lg-6,
    .col-lg-4,
    .col-lg-3 {
        width: auto !important;
        flex: 1 !important;
    }

    .dsp-input,
    .dsp-select,
    input,
    select,
    textarea {
        width: auto !important;
    }

    .btn-dsp,
    button,
    input[type="submit"],
    input[type="button"],
    .btn {
        width: auto !important;
    }

    .chart-wrap {
        height: auto !important;
    }

    a {
        color: #000 !important;
    }
}

/* ===================== PDF EXPORT FIXES ===================== */
.pdf-export {
    background: #fff !important;
    color: #000 !important;
}

.pdf-export * {
    color: #000 !important;
    background: #fff !important;
    border-color: #ccc !important;
}

.pdf-export .dsp-table thead th {
    background: #f5f5f5 !important;
    color: #000 !important;
}

.pdf-export .badge-dsp {
    color: #000 !important;
}
