/* FuelFinder Scotland - Main Stylesheet */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Prevent flash of unstyled content */
html {
    background: #667eea;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;

    /* Force GPU acceleration for smoother rendering */
    transform: translateZ(0);
    backface-visibility: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    position: relative;
}

h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

h1 a {
    color: white;
    text-decoration: none;
}

h1 a:hover {
    opacity: 0.9;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

.error-message {
    background-color: #f44336;
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.1em;
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }
    100% {
        background-position: 200% center;
    }
}

.best {
    background: linear-gradient(
        90deg,
        #667eea 0%,
        #764ba2 25%,
        #8b5cf6 50%,
        #764ba2 75%,
        #667eea 100%
    ) !important;
    background-size: 200% auto !important;
    animation: shimmer 3s linear infinite;
}

#bookmarkBtn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid white;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95em;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

#bookmarkBtn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255,255,255,0.3);
}

#bookmarkBtn:active {
    transform: scale(0.98);
}

.bookmark-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    z-index: 10000;
    text-align: center;
    max-width: 400px;
}

.bookmark-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
}

#radiusSelector,
#locationDropdown,
#fuelTypeSelector {
    background: rgba(255,255,255,0.3);
    color: white;
    border: 2px solid white;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(10px);
    margin: 0 5px;
    transition: all 0.3s ease;
}

#radiusSelector:hover,
#locationDropdown:hover,
#fuelTypeSelector:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.05);
}

#radiusSelector option,
#locationDropdown option,
#fuelTypeSelector option {
    background: #667eea;
    color: white;
}

.section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.section h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.fuel-type-section {
    margin-bottom: 40px;
}

.fuel-type-section:last-child {
    margin-bottom: 0;
}

.fuel-type-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: bold;
}

.cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
    align-items: stretch;
}

.cheapest-card {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-rows: auto minmax(3.5em, auto) auto auto 1fr auto;
    gap: 0;
}

.best-value-card {
    background: linear-gradient(135deg, #5f2c82 0%, #49a09d 100%);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: grid;
    grid-template-rows: auto minmax(3.5em, auto) auto auto 1fr auto;
    gap: 0;
}

.cheapest-card h3,
.best-value-card h3 {
    color: #2c3e50;
    font-size: 1.5em;
    margin-bottom: 15px;
}

.best-value-card h3 {
    color: white;
}

.card-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.3);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75em;
    margin-left: 10px;
    font-weight: normal;
}

.effective-cost {
    font-size: 1.2em;
    color: #2c3e50;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.best-value-card .effective-cost {
    color: white;
}

.best-value-card .price-unit {
    color: white;
}

.best-value-card .station-info {
    color: white;
}

.best-value-card .nearby-distance {
    color: #84fab0;
    font-weight: bold;
}

.price {
    font-size: 2.5em;
    font-weight: bold;
    color: #27ae60;
    margin: 10px 0;
}

.price-unit {
    font-size: 0.5em;
    color: #555;
}

.station-info {
    color: #2c3e50;
    line-height: 1.8;
}

.station-info strong {
    display: inline-block;
    min-width: 100px;
}

.station-name {
    font-weight: bold;
    font-size: 1.5em;
}

.nearby-distance {
    font-weight: bold;
    color: #27ae60;
}

.top-10-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.top-10-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.top-10-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.top-10-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

.top-10-table tbody tr:hover {
    background-color: #f5f5f5;
}

.top-10-table tbody tr:nth-child(even) {
    background-color: #fafafa;
}

.rank {
    font-weight: bold;
    color: #667eea;
    font-size: 1.2em;
    width: 50px;
}

.price-cell {
    font-weight: bold;
    color: #27ae60;
    font-size: 1.3em;
}

.distance-cell {
    color: #666;
}

.distance-cell.nearby {
    font-weight: bold;
    color: #27ae60;
}

/* Station name styling */
.top-10-table td:nth-child(2) {
    font-weight: bold;
    color: #333;
}

/* Map buttons styling */
.top-10-table td:last-child {
    white-space: nowrap;
}

.top-10-table td:last-child a {
    display: inline-block;
    padding: 8px 12px;
    margin: 2px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-size: 1.2em !important;
    background: white;
    border: 2px solid;
}

/* Google Maps - Blue (now first) */
.top-10-table td:last-child a:first-child {
    color: #4285F4 !important;
    border-color: #4285F4;
}

.top-10-table td:last-child a:first-child:hover {
    background: #4285F4;
    color: white !important;
    transform: translateY(-2px);
}

/* OpenStreetMap - Orange (now last) */
.top-10-table td:last-child a:last-child {
    color: #FF6B35 !important;
    border-color: #FF6B35;
}

.top-10-table td:last-child a:last-child:hover {
    background: #FF6B35;
    color: white !important;
    transform: translateY(-2px);
}

/* Card map buttons - base styling */
.card-map-btn {
    display: inline-block;
    padding: 10px 16px;
    margin: 5px 10px 5px 0;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1em;
    border: 2px solid;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-map-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-map-btn:active {
    transform: translateY(0);
}

/* Card map buttons - Both cards use light style */
.card-map-btn-osm-light {
    background: rgba(0, 0, 0, 0.5);
    color: white !important;
    border-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
}

.card-map-btn-osm-light:hover {
    background: white;
    color: #FF6B35 !important;
    border-color: #FF6B35;
}

.card-map-btn-google-light {
    background: rgba(0, 0, 0, 0.5);
    color: white !important;
    border-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(5px);
}

.card-map-btn-google-light:hover {
    background: white;
    color: #4285F4 !important;
    border-color: #4285F4;
}

/* Card map links section - align to bottom with separator */
.card-map-links {
    padding-top: 15px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.no-data {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.2em;
}

.location-chooser {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.location-card {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    display: block;
}

.location-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.location-card h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2em;
}

.location-card p {
    color: #666;
    font-size: 1.1em;
    margin: 10px 0;
}

.location-card .icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.location-switcher {
    background: white;
    border-radius: 10px;
    padding: 15px 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.location-switcher h3 {
    color: #667eea;
    margin: 0;
    font-size: 1.3em;
}

.location-buttons {
    display: flex;
    gap: 10px;
}

.location-btn {
    padding: 10px 20px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.location-btn:hover {
    background: #667eea;
    color: white;
}

.location-btn.active {
    background: #667eea;
    color: white;
}

footer {
    text-align: center;
    color: white;
    margin-top: 40px;
    opacity: 0.8;
    padding: 20px;
}

footer a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
}

footer a:hover {
    text-decoration: underline;
}

.nav-links {
    margin-top: 15px;
}

.nav-links a {
    margin: 0 15px;
    font-size: 0.95em;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    #bookmarkBtn {
        position: static !important;
        display: block;
        margin: 15px auto 0 auto !important;
    }
}

@media (max-width: 882px) {
    h1 {
        font-size: 1.8em;
    }

    .section {
        padding: 20px;
    }

    /* Convert table to card layout on mobile */
    .top-10-table {
        display: block;
        border: none;
    }

    .top-10-table thead {
        display: none;
    }

    .top-10-table tbody {
        display: block;
    }

    .top-10-table tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-gap: 12px;
        margin-bottom: 20px;
        background: white;
        border: 2px solid #e0e0e0;
        border-radius: 12px;
        padding: 15px;
        padding-top: 20px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        position: relative;
    }

    .top-10-table tr:nth-child(even) {
        background: white;
    }

    .top-10-table tr:hover {
        background: #f9f9f9;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    .top-10-table td {
        padding: 0;
        border: none;
    }

    .top-10-table td:before {
        content: attr(data-label);
        display: block;
        font-weight: bold;
        color: #667eea;
        font-size: 0.75em;
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    /* Station name - full width */
    .top-10-table td:nth-child(2) {
        grid-column: 1 / -1;
        font-weight: bold;
        font-size: 1.2em;
        color: #333;
        margin-bottom: 8px;
        padding-right: 50px;
    }

    /* Maps - full width at bottom */
    .top-10-table td:last-child {
        grid-column: 1 / -1;
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid #e0e0e0;
    }

    /* Rank badge styling for mobile */
    .top-10-table .rank {
        position: absolute;
        top: 15px;
        right: 15px;
        background: #6c757d;
        color: white;
        width: 35px;
        height: 35px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 1.1em;
        padding: 0;
    }

    .top-10-table .rank:before {
        content: '';
        display: none;
    }

    /* Price - make it prominent */
    .top-10-table .price-cell {
        font-size: 1.4em;
        font-weight: bold;
    }

    .top-10-table .distance-cell {
        font-size: 1em;
    }

    /* Map buttons - larger and better spaced on mobile */
    .top-10-table td:last-child a {
        display: inline-block;
        padding: 12px 16px;
        margin: 5px 8px 5px 0;
        background: white;
        border: 2px solid;
        border-radius: 8px;
        font-size: 1.4em !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    /* Google Maps - Blue (mobile, now first) */
    .top-10-table td:last-child a:first-child {
        color: #4285F4 !important;
        border-color: #4285F4;
    }

    /* OpenStreetMap - Orange (mobile, now last) */
    .top-10-table td:last-child a:last-child {
        color: #FF6B35 !important;
        border-color: #FF6B35;
    }

    .top-10-table td:last-child a:active {
        transform: scale(0.95);
    }
}
