/* Responsive Table Styles for Recent Earthquakes */

/* Base Table Styles (applied to all screen sizes) */
.earthquakes-table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.earthquakes-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
}

/* Mobile table layout - hidden by default */
.earthquakes-table-mobile {
    display: none;
}

.table-header {
    background: #d0021b;
    color: #ffffff;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    position: relative;
}

.sort-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    margin-left: 0.75rem;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    position: relative;
    flex-shrink: 0;
}

.sort-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sort-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.sort-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sort-icon {
    font-weight: bold;
    transition: color 0.2s ease;
    font-size: 0.9rem;
}

/* Add a subtle tooltip effect */
.sort-btn::after {
    content: "Sort";
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.sort-btn:hover::after {
    opacity: 1;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-content span {
    flex: 1;
}

.magnitude-header {
    width: 120px;
}

.location-header {
    width: auto;
}

.depth-header {
    width: 100px;
}

.date-header {
    width: 150px;
}

.earthquake-row {
    border-bottom: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.earthquake-row:hover {
    background-color: #f8f9fa;
    transform: translateX(2px);
}

.earthquake-row:last-child {
    border-bottom: none;
}

.magnitude-cell {
    padding: 0.5rem 1rem;
    vertical-align: middle;
}

.location-cell {
    padding: 0.5rem 1rem;
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
    vertical-align: middle;
}

.depth-cell {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: #495057;
    text-align: center;
    vertical-align: middle;
    font-weight: 500;
}

.date-cell {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    color: #6c757d;
    text-align: right;
    vertical-align: middle;
    line-height: 1.3;
}

.magnitude-badge {
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    text-align: center;
    display: inline-block;
    min-width: 50px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.magnitude-high { 
    background: linear-gradient(135deg, #d9534f 0%, #c9302c 100%);
    box-shadow: 0 2px 4px rgba(217, 83, 79, 0.3);
}

.magnitude-medium { 
    background: linear-gradient(135deg, #f0ad4e 0%, #ec971f 100%);
    box-shadow: 0 2px 4px rgba(240, 173, 78, 0.3);
}

.magnitude-low { 
    background: linear-gradient(135deg, #5cb85c 0%, #449d44 100%);
    box-shadow: 0 2px 4px rgba(92, 184, 92, 0.3);
}

/* Desktop Styles (992px and above) */
@media (min-width: 992px) {
    /* Desktop uses base styles - no additional overrides needed */
}

/* Tablet Styles (768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .earthquakes-table-container {
        overflow-x: auto;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

    .earthquakes-table {
        width: 100%;
        border-collapse: collapse;
        background: #ffffff;
        border-radius: 8px;
        overflow: hidden;
        font-size: 0.9rem;
    }

    .table-header {
        background: #d0021b !important;
        color: #ffffff !important;
        padding: 0.6rem 0.8rem;
        text-align: left;
        font-weight: 700;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border: none;
        position: relative;
    }

    .header-content {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }

    .header-content span {
        flex: 1;
    }

    .magnitude-header {
        width: 100px;
        background: #d0021b !important;
        color: #ffffff !important;
    }

    .location-header {
        width: auto;
        background: #d0021b !important;
        color: #ffffff !important;
    }

    .depth-header {
        width: 80px;
        background: #d0021b !important;
        color: #ffffff !important;
    }

    .date-header {
        width: 120px;
        background: #d0021b !important;
        color: #ffffff !important;
    }

    .earthquake-row {
        border-bottom: 1px solid #e9ecef;
        transition: all 0.2s ease;
    }

    .earthquake-row:hover {
        background-color: #f8f9fa;
        transform: translateX(2px);
    }

    .earthquake-row:last-child {
        border-bottom: none;
    }

    .magnitude-cell {
        padding: 0.4rem 0.8rem;
        vertical-align: middle;
    }

    .location-cell {
        padding: 0.4rem 0.8rem;
        font-weight: 600;
        color: #333;
        font-size: 0.85rem;
        vertical-align: middle;
    }

    .depth-cell {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        color: #495057;
        text-align: center;
        vertical-align: middle;
        font-weight: 500;
    }

    .date-cell {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
        color: #6c757d;
        text-align: right;
        vertical-align: middle;
        line-height: 1.3;
    }

    .magnitude-badge {
        padding: 0.3rem 0.5rem;
        font-size: 0.8rem;
        min-width: 45px;
    }
}

/* Mobile Styles (below 768px) */
@media (max-width: 767px) {
    .earthquakes-table-container {
        margin: 0 -1rem;
        border-radius: 0;
        overflow: visible;
        box-shadow: none;
    }

    /* Hide the traditional table on mobile */
    .earthquakes-table {
        display: none;
    }

    /* Show mobile card layout */
    .earthquakes-table-mobile {
        display: block;
    }

    /* Mobile card container */
    .mobile-earthquake-cards {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 0 1rem;
    }

    /* Individual earthquake card */
    .mobile-earthquake-card {
        background: #ffffff;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        padding: 1rem;
        border-left: 4px solid #d0021b;
        transition: all 0.2s ease;
    }

    .mobile-earthquake-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    }

    /* Card header with magnitude and date */
    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 0.75rem;
        gap: 0.5rem;
    }

    .mobile-magnitude-section {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .mobile-magnitude-badge {
        padding: 0.4rem 0.6rem;
        border-radius: 8px;
        font-weight: 700;
        font-size: 0.9rem;
        color: #fff;
        text-align: center;
        display: inline-block;
        min-width: 50px;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .mobile-magnitude-label {
        font-size: 0.8rem;
        color: #6c757d;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .mobile-date-time {
        text-align: right;
        font-size: 0.75rem;
        color: #6c757d;
        line-height: 1.3;
        flex-shrink: 0;
    }

    /* Card body with location and depth */
    .mobile-card-body {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .mobile-location-section {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .mobile-location-label {
        font-size: 0.8rem;
        color: #6c757d;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        min-width: 60px;
    }

    .mobile-location-value {
        font-weight: 600;
        color: #333;
        font-size: 0.9rem;
        flex: 1;
    }

    .mobile-depth-section {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .mobile-depth-label {
        font-size: 0.8rem;
        color: #6c757d;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        min-width: 60px;
    }

    .mobile-depth-value {
        font-size: 0.9rem;
        color: #495057;
        font-weight: 500;
    }

    /* Magnitude badge colors for mobile */
    .mobile-magnitude-high { 
        background: linear-gradient(135deg, #d9534f 0%, #c9302c 100%);
        box-shadow: 0 2px 4px rgba(217, 83, 79, 0.3);
    }

    .mobile-magnitude-medium { 
        background: linear-gradient(135deg, #f0ad4e 0%, #ec971f 100%);
        box-shadow: 0 2px 4px rgba(240, 173, 78, 0.3);
    }

    .mobile-magnitude-low { 
        background: linear-gradient(135deg, #5cb85c 0%, #449d44 100%);
        box-shadow: 0 2px 4px rgba(92, 184, 92, 0.3);
    }

    /* No data message for mobile */
    .mobile-no-data {
        text-align: center;
        padding: 2rem 1rem;
        color: #6c757d;
        font-style: italic;
        background: #f8f9fa;
        border-radius: 12px;
        margin: 0 1rem;
    }
}

/* Small Mobile Styles (below 480px) */
@media (max-width: 479px) {
    .mobile-earthquake-card {
        padding: 0.75rem;
        border-radius: 8px;
    }

    .mobile-card-header {
        margin-bottom: 0.5rem;
    }

    .mobile-magnitude-badge {
        padding: 0.3rem 0.5rem;
        font-size: 0.85rem;
        min-width: 45px;
    }

    .mobile-magnitude-label,
    .mobile-location-label,
    .mobile-depth-label {
        font-size: 0.75rem;
        min-width: 50px;
    }

    .mobile-location-value,
    .mobile-depth-value {
        font-size: 0.85rem;
    }

    .mobile-date-time {
        font-size: 0.7rem;
    }

    .mobile-card-body {
        gap: 0.4rem;
    }
}

/* Landscape Mobile Styles */
@media (max-width: 767px) and (orientation: landscape) {
    .mobile-earthquake-cards {
        gap: 0.5rem;
    }

    .mobile-earthquake-card {
        padding: 0.75rem;
    }

    .mobile-card-header {
        margin-bottom: 0.5rem;
    }

    .mobile-card-body {
        gap: 0.4rem;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .earthquake-row,
    .mobile-earthquake-card {
        transition: none;
    }

    .earthquake-row:hover,
    .mobile-earthquake-card:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mobile-earthquake-card {
        border: 2px solid #000;
    }

    .mobile-magnitude-badge {
        border: 1px solid #fff;
    }
}
