@media (max-width: 768px) {
    /* Hero Section */
    .opportunities-hero {
        padding: 2rem 0 1.5rem 0 !important;
    }

    .opportunities-hero h1 {
        font-size: 1.75rem !important;
        margin-bottom: 0.75rem !important;
        line-height: 1.2;
    }

    .opportunities-hero p {
        font-size: 0.95rem !important;
        margin-bottom: 1.25rem !important;
        line-height: 1.4;
    }

    .opportunities-hero .d-flex.flex-wrap {
        gap: 1.25rem !important;
        justify-content: space-around !important;
    }

    .opportunities-hero .text-center {
        min-width: 90px;
        flex: 1 1 auto;
    }

    .opportunities-hero .fw-bold.fs-3 {
        font-size: 1.6rem !important;
    }

    .opportunities-hero .opacity-75 {
        font-size: 0.8rem;
        line-height: 1.2;
    }

    .hero-illustration {
        display: none !important;
    }

    /* Header */
    .container.my-4 {
        margin-top: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .container.my-4 h2 {
        font-size: 1.3rem !important;
        margin-bottom: 0.35rem !important;
    }

    .container.my-4 h2 + p {
        font-size: 0.85rem;
    }

    /* Filter buttons */
    .d-flex.justify-content-between.align-items-center {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
    }

    .d-flex.justify-content-between.align-items-center > div:last-child {
        width: 100%;
    }

    .d-flex.gap-2.align-items-center {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 0.5rem !important;
        overflow-x: auto;
        overflow-y: visible !important;
        width: 100% !important;
    }

    /* Hide view toggle on mobile */
    .view-toggle {
        display: none !important;
    }

    /* Buttons */
    .btn-outline-primary, .btn-success, .btn-group .btn {
        padding: 0.55rem 0.75rem !important;
        font-size: 0.85rem !important;
        height: 44px !important;
        white-space: nowrap;
        min-width: 50px;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .btn-outline-primary i, .btn-success i {
        font-size: 1rem;
        margin: 0 !important;
    }

    /* Hide button text on mobile - show only icons */
    .btn .d-none.d-sm-inline {
        display: none !important;
    }

    .btn-success .d-inline.d-sm-none {
        display: inline !important;
    }

    /* Button group */
    .btn-group {
        display: inline-flex !important;
        position: relative !important;
    }

    .btn-group .dropdown-menu {
        position: absolute !important;
        z-index: 1050 !important;
    }

    /* Container padding */
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    /* Cards - force compact list view on mobile */
    .opportunities-grid {
        display: block !important;
        padding: 0 !important;
    }

    .opportunities-grid .col-lg-4,
    .opportunities-grid .col-md-6 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin-bottom: 1rem !important;
    }

    .opportunity-card {
        display: block !important;
        height: auto !important;
        padding: 1rem !important;
        border-radius: 12px !important;
        position: relative !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
    }

    /* Urgent badge repositioning */
    .urgent-badge {
        position: absolute !important;
        top: 0.5rem !important;
        right: 0.5rem !important;
        font-size: 0.65rem !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* NGO info and title */
    .opportunity-header {
        padding: 0 !important;
        margin-bottom: 0.5rem !important;
        border: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }

    .opportunity-header .ngo-logo {
        width: 40px !important;
        height: 40px !important;
        border-radius: 8px !important;
    }

    .opportunity-header .ngo-info {
        flex: 1 !important;
    }

    .opportunity-header .ngo-info h6 {
        font-size: 0.8rem !important;
        margin-bottom: 0.15rem !important;
    }

    /* Title */
    .opportunity-body {
        padding: 0 !important;
    }

    .opportunity-card h5 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.3;
        padding-right: 4rem !important;
    }

    .opportunity-card .text-muted {
        font-size: 0.8rem !important;
        margin-bottom: 0.5rem !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    /* Meta info in compact row */
    .opportunity-meta {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        font-size: 0.75rem !important;
        margin-bottom: 0.5rem !important;
    }

    .opportunity-meta > div {
        display: flex !important;
        align-items: center !important;
        gap: 0.25rem !important;
    }

    .opportunity-meta i {
        font-size: 0.85rem !important;
    }

    .opportunity-card .badge {
        font-size: 0.65rem !important;
        padding: 0.2rem 0.4rem !important;
    }

    /* Hide less important elements on mobile */
    .opportunity-requirements,
    .opportunity-skills,
    .opportunity-description,
    .opportunity-footer {
        display: none !important;
    }

    /* Show only essential info */
    .opportunity-location,
    .opportunity-date,
    .opportunity-type,
    .opportunity-spots {
        display: inline-flex !important;
        font-size: 0.75rem !important;
    }

    /* Progress bar */
    .opportunity-card .progress {
        height: 4px !important;
        margin-top: 0.5rem !important;
    }

    /* Filter collapse section */
    #filterCollapse {
        margin-top: 0.75rem;
    }

    /* Search form improvements for mobile */
    .search-card {
        padding: 1rem !important;
        border-radius: 16px !important;
    }

    .search-card .row {
        gap: 0.75rem;
    }

    .search-card .col-lg-4,
    .search-card .col-lg-3,
    .search-card .col-lg-2 {
        padding: 0 !important;
    }

    .search-card .form-label {
        font-size: 0.85rem !important;
        margin-bottom: 0.4rem !important;
    }

    .search-card .input-group-lg,
    .search-card .form-select-lg {
        font-size: 0.95rem !important;
    }

    .search-card .input-group-text {
        padding: 0.6rem 0.75rem !important;
    }

    .search-card .form-control,
    .search-card .form-select {
        padding: 0.6rem 0.75rem !important;
        font-size: 0.95rem !important;
        height: 44px !important;
    }

    .search-card .btn-primary {
        height: 48px !important;
        font-size: 1rem !important;
        font-weight: 600 !important;
    }

    /* Active filters on mobile */
    .search-card .filter-badge {
        font-size: 0.8rem !important;
        padding: 0.4rem 0.6rem !important;
    }

    /* Results header on mobile */
    .container.my-4 .d-flex.justify-content-between {
        margin-bottom: 1rem !important;
    }

    /* Pagination improvements */
    .pagination {
        flex-wrap: wrap;
        justify-content: center !important;
        gap: 0.25rem;
    }

    .pagination .page-item {
        margin: 0.15rem;
    }

    .pagination .page-link {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.85rem !important;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .pagination .page-item:first-child .page-link,
    .pagination .page-item:last-child .page-link {
        border-radius: 8px;
    }

    /* Hide some pagination items on mobile */
    .pagination .page-item:not(:first-child):not(:last-child):not(.active) {
        display: none;
    }

    .pagination .page-item.active,
    .pagination .page-item:first-child,
    .pagination .page-item:last-child,
    .pagination .page-item.active + .page-item,
    .pagination .page-item:has(+ .active) {
        display: block;
    }

    /* Empty state on mobile */
    .empty-state {
        padding: 2rem 1rem !important;
        margin: 1.5rem 0 !important;
    }

    .empty-state-icon {
        font-size: 3rem !important;
    }

    .empty-state h4 {
        font-size: 1.1rem !important;
    }

    .empty-state p {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 576px) {
    /* Extra small screens */
    .opportunities-hero {
        padding: 1.5rem 0 1rem 0 !important;
    }

    .opportunities-hero h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
        line-height: 1.15;
    }

    .opportunities-hero p {
        font-size: 0.875rem !important;
        line-height: 1.35;
        margin-bottom: 1rem !important;
    }

    .opportunities-hero .fw-bold.fs-3 {
        font-size: 1.4rem !important;
    }

    .opportunities-hero .d-flex.flex-wrap {
        gap: 1rem !important;
    }

    .opportunities-hero .text-center {
        min-width: 85px;
    }

    .container.my-4 h2 {
        font-size: 1.15rem !important;
        line-height: 1.3;
    }

    .container.my-4 h2 + p {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .btn-outline-primary, .btn-success, .btn-group .btn {
        padding: 0.5rem 0.7rem !important;
        font-size: 0.8rem !important;
        height: 44px !important;
        min-width: 44px;
    }

    .d-flex.gap-2.align-items-center {
        gap: 0.4rem !important;
    }

    /* Extra compact on small screens */
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .opportunity-card {
        padding: 0.9rem !important;
        margin-bottom: 0.85rem !important;
        border-radius: 14px !important;
    }

    .opportunity-header .ngo-logo {
        width: 38px !important;
        height: 38px !important;
    }

    .opportunity-header .ngo-info h6 {
        font-size: 0.75rem !important;
    }

    .opportunity-card h5 {
        font-size: 0.95rem !important;
        padding-right: 3.5rem !important;
        line-height: 1.25;
    }

    .opportunity-card .text-muted {
        font-size: 0.75rem !important;
        -webkit-line-clamp: 2 !important;
        line-height: 1.4;
    }

    .opportunity-meta {
        gap: 0.4rem !important;
        font-size: 0.7rem !important;
    }

    .urgent-badge {
        font-size: 0.6rem !important;
        padding: 0.2rem 0.4rem !important;
    }

    /* Search card on extra small screens */
    .search-card {
        padding: 0.85rem !important;
    }

    .search-card .form-label {
        font-size: 0.8rem !important;
    }

    .search-card .form-control,
    .search-card .form-select {
        font-size: 0.9rem !important;
    }

    /* Results header */
    .container.my-4 h3 {
        font-size: 1rem !important;
    }

    .container.my-4 h3 + p {
        font-size: 0.8rem !important;
    }

    /* Pagination on extra small screens */
    .pagination .page-link {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.8rem !important;
        min-width: 40px;
        min-height: 40px;
    }

    .pagination small {
        font-size: 0.75rem !important;
    }
}

@media (max-width: 400px) {
    /* Very small screens - optimize for smallest phones */
    .opportunities-hero {
        padding: 1rem 0 0.75rem 0 !important;
    }

    .opportunities-hero h1 {
        font-size: 1.35rem !important;
    }

    .opportunities-hero p {
        font-size: 0.825rem !important;
    }

    .opportunities-hero .fw-bold.fs-3 {
        font-size: 1.25rem !important;
    }

    .opportunities-hero .text-center {
        min-width: 75px;
    }

    .opportunities-hero .opacity-75 {
        font-size: 0.7rem;
    }

    .container {
        padding-left: 0.65rem !important;
        padding-right: 0.65rem !important;
    }

    .container.my-4 h2 {
        font-size: 1.05rem !important;
    }

    .opportunity-card {
        padding: 0.8rem !important;
        margin-bottom: 0.75rem !important;
    }

    .opportunity-card h5 {
        font-size: 0.9rem !important;
    }

    .opportunity-meta {
        font-size: 0.675rem !important;
    }

    .search-card {
        padding: 0.75rem !important;
    }

    .btn-outline-primary, .btn-success, .btn-group .btn {
        padding: 0.45rem 0.65rem !important;
        font-size: 0.75rem !important;
        height: 42px !important;
        min-width: 42px;
    }

    /* Make filter buttons more compact */
    .d-flex.gap-2.align-items-center {
        gap: 0.35rem !important;
    }
}

/* Additional mobile-friendly improvements across all breakpoints */
@media (max-width: 768px) {
    /* Improve tap targets - ensure minimum 44px */
    a, button {
        -webkit-tap-highlight-color: rgba(102, 126, 234, 0.2);
    }

    /* Smooth scrolling for filter buttons */
    .d-flex.gap-2.align-items-center {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
        scrollbar-width: none; /* Firefox */
    }

    .d-flex.gap-2.align-items-center::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }

    /* Better card spacing on mobile */
    .opportunities-grid .col-lg-4,
    .opportunities-grid .col-md-6 {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Ensure form inputs are easy to tap */
    input[type="text"],
    select {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* Better visual feedback on touch */
    .opportunity-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    .btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
}

/* Base Styles - Desktop and All Screens */
.opportunities-hero {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 200px;
}

.hero-glassmorphism {
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(10px);
}

.hero-content-container {
    z-index: 10;
}

.hero-illustration i {
    font-size: 8rem;
    opacity: 0.3;
}

/* Form Labels */
.form-label-primary {
    color: var(--text-primary);
}

/* Filter Badges */
.filter-badge {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.filter-badge a {
    color: var(--text-primary);
}

/* Empty State Icon */
.empty-state-icon {
    font-size: 4rem;
}

/* Dropdown positioning helper */
.dropdown-positioned {
    position: relative;
}

.dropdown-menu-positioned {
    position: absolute;
    top: 100%;
    margin-top: 0.125rem;
}

/* View Toggle */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
}

.view-toggle-btn {
    border: none;
    background: transparent;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--btn-primary);
    color: white;
}

.view-toggle-btn i {
    font-size: 1.1rem;
}

/* Search Card */
.search-card {
    border-color: #e9ecef !important;
    transition: all 0.3s ease;
    background-color: var(--card-bg) !important;
}

[data-theme="dark"] .search-card {
    border-color: var(--border-color) !important;
}

.search-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    border-color: #dee2e6 !important;
}

[data-theme="dark"] .search-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

.search-card .input-group-text {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

[data-theme="dark"] .search-card .input-group-text {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.search-card .form-control::placeholder {
    color: #6c757d;
}

[data-theme="dark"] .search-card .form-control::placeholder {
    color: var(--text-muted);
}

.search-card .form-control:focus,
.search-card .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

.search-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    transition: all 0.3s ease;
    font-weight: 600;
}

.search-btn:hover {
    background: linear-gradient(135deg, #5568d3, #6a3f8f);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* Opportunity Cards */
.opportunity-card-link {
    display: block;
    height: 100%;
    color: inherit;
}

.opportunity-card-link:hover {
    color: inherit;
}

.opportunity-card {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: none;
    overflow: hidden;
    position: relative;
    height: 100%;
}

[data-theme="dark"] .opportunity-card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.opportunity-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .opportunity-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.opportunity-header {
    padding: 20px 20px 0 20px;
    position: relative;
}

.urgent-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.category-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    gap: 8px;
}

.opportunity-body {
    padding: 20px;
}

.ngo-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
}

.ngo-logo-placeholder {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
}

.ngo-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.verified-badge-small {
    font-size: 0.75rem;
    color: #28a745;
    font-weight: 500;
}

.opportunity-title {
    font-weight: 700;
    color: var(--text-primary);
    margin: 15px 0 10px 0;
    line-height: 1.3;
}

.opportunity-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.opportunity-details {
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #4a5568;
}

.detail-item i {
    width: 16px;
    margin-right: 8px;
    color: #667eea;
}

.spots-progress .progress {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin-bottom: 5px;
}

.spots-progress .progress-bar {
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
}

.opportunity-footer {
    padding: 0 20px 20px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.deadline-info {
    flex: 1;
}

/* Empty State */
.empty-state {
    background: var(--bg-secondary);
    border-radius: 20px;
    margin: 40px 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .opportunities-hero h1 {
        font-size: 2.5rem;
    }

    .search-card {
        padding: 20px 15px !important;
    }
}

/* List View */
.list-view {
    display: block !important;
    margin: 0 !important;
}

.list-view > .col-lg-4,
.list-view > .col-md-6 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 0 20px 0 !important;
}

.list-view .opportunity-card {
    border-radius: 12px;
    margin-bottom: 0;
    display: grid !important;
    grid-template-columns: auto 1fr auto;
    grid-template-rows: auto;
    gap: 0;
    align-items: stretch;
    width: 100%;
}

.list-view .opportunity-card:hover {
    transform: translateY(-2px);
}

.list-view .opportunity-header {
    grid-column: 1;
    grid-row: 1;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 10px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border-radius: 12px 0 0 12px;
    min-width: 150px;
}

.list-view .urgent-badge {
    position: static;
    margin-bottom: 8px;
}

.list-view .category-badge {
    margin: 0;
}

.list-view .opportunity-body {
    grid-column: 2;
    grid-row: 1;
    padding: 25px 20px;
    display: block;
}

.list-view .ngo-info {
    margin-bottom: 15px;
}

.list-view .opportunity-title {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.list-view .opportunity-description {
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.list-view .opportunity-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 20px;
    margin-bottom: 15px;
}

.list-view .detail-item {
    margin-bottom: 0;
}

.list-view .spots-progress {
    max-width: 400px;
}

.list-view .opportunity-footer {
    grid-column: 3;
    grid-row: 1;
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    border-left: 1px solid #e9ecef;
    min-width: 180px;
}

.list-view .deadline-info {
    text-align: center;
    margin: 0;
}

.list-view .opportunity-footer .btn {
    white-space: nowrap;
}

@media (max-width: 992px) {
    .list-view .opportunity-card {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
    }

    .list-view .opportunity-header {
        grid-column: 1;
        grid-row: 1;
        border-radius: 12px 12px 0 0;
        flex-direction: row;
        align-items: center;
        gap: 15px;
        min-width: unset;
    }

    .list-view .opportunity-body {
        grid-column: 1;
        grid-row: 2;
    }

    .list-view .opportunity-footer {
        grid-column: 1;
        grid-row: 3;
        border-left: none;
        border-top: 1px solid #e9ecef;
        flex-direction: row;
        justify-content: space-between;
        min-width: unset;
    }
