
/**
 * ISP Management System - Responsive Styles
 * =========================================
 */

/* Tablet (768px - 991px) */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 1050;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1040;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    .topbar {
        padding: 12px 15px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-card .number {
        font-size: 1.8rem;
    }

    .chat-panel {
        width: 100%;
        right: 0;
        bottom: 0;
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }

    .chat-btn {
        bottom: 20px;
        right: 20px;
    }

    .port-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }

    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .table-responsive {
        border-radius: var(--border-radius);
    }
}

/* Mobile (up to 767px) */
@media (max-width: 767px) {
    body {
        font-size: 14px;
    }

    .sidebar-brand h4 {
        font-size: 1.2rem;
    }

    .main-content {
        padding: 10px;
    }

    .topbar {
        padding: 10px 15px;
        margin-bottom: 15px;
    }

    .topbar h5 {
        font-size: 1.1rem;
    }

    .stat-card {
        padding: 15px;
        margin-bottom: 15px;
    }

    .stat-card .number {
        font-size: 1.6rem;
    }

    .stat-card .label {
        font-size: 0.8rem;
    }

    .stat-card i {
        font-size: 2rem;
    }

    .card-body {
        padding: 15px;
    }

    .card-header {
        padding: 12px 15px;
    }

    .row.g-3 {
        --bs-gutter-x: 10px;
        --bs-gutter-y: 10px;
    }

    .table-actions .btn {
        padding: 4px 8px;
        font-size: 0.75rem;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .form-control, .form-select {
        padding: 10px 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .modal-body {
        padding: 15px;
    }

    .modal-footer {
        padding: 12px 15px;
    }

    .chat-widget {
        bottom: 15px;
        right: 15px;
    }

    .chat-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }

    .chat-panel {
        width: 100%;
        right: 0;
        bottom: 0;
        height: 100vh;
        border-radius: 0;
    }

    .port-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }

    .port-card {
        padding: 10px;
    }

    .port-number {
        font-size: 1rem;
    }

    .login-card .card-body {
        padding: 25px;
    }

    .login-logo {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }

    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        text-align: left;
        float: none;
        margin-bottom: 10px;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        margin-left: 0;
    }

    .timeline {
        padding-left: 20px;
    }

    .timeline-item::before {
        left: -22px;
    }
}

/* Small Mobile (up to 375px) */
@media (max-width: 375px) {
    .stat-card .number {
        font-size: 1.4rem;
    }

    .port-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .table-actions {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .table-actions .btn {
        width: 100%;
    }
}

/* Landscape Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-panel {
        height: 100vh;
    }

    .sidebar {
        overflow-y: auto;
    }

    .login-page {
        padding: 20px 0;
    }
}

/* High DPI / Retina */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .stat-card i,
    .login-logo,
    .chat-btn {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark Mode Mobile */
@media (prefers-color-scheme: dark) and (max-width: 991px) {
    .sidebar-overlay {
        background: rgba(0,0,0,0.7);
    }
}

/* Print Styles */
@media print {
    @page {
        margin: 15mm;
        size: auto;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .sidebar,
    .chat-widget,
    .topbar,
    .btn,
    .table-actions,
    .modal,
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_paginate,
    .dataTables_wrapper .dataTables_info {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
        break-inside: avoid;
        margin-bottom: 15px;
    }

    .card-header {
        background: #f5f5f5 !important;
        border-bottom: 2px solid #ddd !important;
    }

    .table {
        font-size: 11pt;
    }

    .table thead th {
        background: #f5f5f5 !important;
        border-bottom: 2px solid #333;
    }

    .badge-status,
    .badge {
        border: 1px solid #999;
        background: white !important;
        color: black !important;
    }

    a {
        text-decoration: none !important;
        color: black !important;
    }

    a[href]:after {
        content: "" !important;
    }

    .profit-positive,
    .profit-negative,
    .text-success,
    .text-danger {
        color: black !important;
        font-weight: bold;
    }

    .stat-card {
        background: white !important;
        color: black !important;
        border: 2px solid #333;
    }

    .stat-card i {
        display: none;
    }

    canvas {
        display: none !important;
    }

    h4, h5, h6 {
        page-break-after: avoid;
    }

    tr {
        page-break-inside: avoid;
    }
}
