/* ===== RESPONSIVE STYLES FOR OPPORTUNITIES PAGE ===== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {

    /* Filter grid: 2 columns on tablet */
    .filters-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }

    /* Reduce table font size */
    .opportunities-table {
        font-size: 0.9rem;
    }

    .opportunities-table th,
    .opportunities-table td {
        padding: 0.75rem 0.5rem;
    }

    /* Make table scrollable horizontally */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Adjust button sizes */
    .btn-primary,
    .btn-secondary {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
}

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

    /* Single column filter layout */
    .filters-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    /* Stack header actions vertically */
    .opportunities-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .opportunities-header h1 {
        font-size: 1.5rem;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
    }

    .header-actions>* {
        width: 100%;
    }

    /* Bulk actions bar */
    .bulk-actions-bar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.75rem;
        padding: 1rem;
    }

    .bulk-actions-bar select,
    .bulk-actions-bar button {
        width: 100%;
    }

    /* Touch-friendly buttons - minimum 48px */
    .btn-primary,
    .btn-secondary,
    button,
    select {
        min-height: 48px;
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }

    /* Table: horizontal scroll */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        /* Extend to edges */
    }

    .opportunities-table {
        min-width: 800px;
        /* Force horizontal scroll */
        font-size: 0.85rem;
    }

    .opportunities-table th,
    .opportunities-table td {
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
    }

    /* Checkbox column */
    .opportunities-table th:first-child,
    .opportunities-table td:first-child {
        position: sticky;
        left: 0;
        background: var(--glass-surface);
        z-index: 1;
    }

    /* Pagination: stack on mobile */
    .pagination-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch !important;
    }

    .pagination-info {
        text-align: center;
    }

    .pagination-buttons {
        justify-content: center;
        width: 100%;
    }

    .pagination-buttons button {
        flex: 1;
        max-width: 120px;
    }

    /* Stats cards: single column */
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    /* Reduce padding on mobile */
    .dashboard-content {
        padding: 1rem;
    }

    .glass-panel {
        padding: 1rem;
    }

    /* Multi-select filters: better mobile UX */
    select[multiple] {
        min-height: 120px;
        font-size: 1rem;
    }

    /* Date inputs: full width */
    input[type="date"] {
        width: 100%;
        min-height: 48px;
    }

    /* Search input */
    input[type="text"],
    input[type="search"] {
        min-height: 48px;
        font-size: 1rem;
    }

    /* Range slider */
    input[type="range"] {
        min-height: 48px;
    }

    /* Toast notifications: full width on mobile */
    .toast {
        left: 1rem;
        right: 1rem;
        max-width: none;
    }
}

/* Extra small mobile (< 480px) */
@media (max-width: 480px) {
    .opportunities-header h1 {
        font-size: 1.25rem;
    }

    .opportunities-table {
        font-size: 0.8rem;
    }

    .btn-primary,
    .btn-secondary {
        font-size: 0.9rem;
    }

    /* Hide less important columns on very small screens */
    .opportunities-table th:nth-child(5),
    .opportunities-table td:nth-child(5) {
        display: none;
        /* Hide confidence column */
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .filters-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    select[multiple] {
        size: 3;
        /* Reduce height in landscape */
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    button,
    a,
    select,
    input {
        min-height: 44px;
    }

    /* Remove hover effects on touch devices */
    .opportunities-table tbody tr:hover {
        background: transparent;
    }

    /* Add active state instead */
    .opportunities-table tbody tr:active {
        background: var(--glass-hover);
    }
}