body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    margin: 0;
    font-family: 'Montserrat', Arial, sans-serif;
    padding: 0;
    background-color: #f0f5f9;
    color: #2d3748;
    min-height: 100vh;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
}

.header-content {
    width: 100%;
    max-width: 1200px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 0 10px;
}

.back-button {
    background-color: #4299e1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-button:hover {
    background-color: #3182ce;
}

.page-header {
    color: #1a365d;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    text-align: center;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-content {
    margin-top: 80px;
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
    box-sizing: border-box;
}

.section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    padding: 25px;
    width: 100%;
    box-sizing: border-box;
}

.section-title {
    color: #2c5282;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background-color: #4299e1;
    border-radius: 2px;
    display: inline-block;
}

.controls-row {
    display: flex;
    gap: 20px;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
}

.weather-info-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    width: 100%;
}

.weather-info-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-box {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.info-box h3 {
    color: #2c5282;
    margin: 0 0 10px 0;
    font-size: 16px;
}

.info-box p {
    margin: 5px 0;
    color: #4a5568;
    font-size: 14px;
}

.weather-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    flex: 2;
}

.weather-icon img {
    width: 120px;
    height: 120px;
    object-fit: contain;
}

.weather-icon h3 {
    margin-bottom: 15px;
}

.weather-icon svg {
    margin: 10px 0;
}

.weather-description {
    margin-top: 10px;
    color: #4a5568;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.charts-container {
    flex: 1;
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
}

.chart-item {
    min-height: 300px;
    height: 100%;
    width: 100%;
    max-width: 400px;
    max-height: 400px;
    text-align: center;
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: fadeInUp 0.6s ease-out forwards;
    opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chart-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.chart-item h3 {
    margin-bottom: 15px;
    color: #2c5282;
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
}

.chart-item canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 300px;
    max-height: 300px;
    margin: auto;
}

.pie-chart-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pie-chart-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(16px, 4vw, 24px);
    font-weight: 700;
    color: #2c5282;
    text-align: center;
    line-height: 1.2;
}

.pie-chart-value .percentage {
    font-size: clamp(24px, 6vw, 32px);
    display: block;
    margin-bottom: 4px;
}

.pie-chart-value .label {
    font-size: clamp(12px, 3vw, 16px);
    color: #4a5568;
    font-weight: 500;
}

.chart-container {
    width: 100%;
    max-width: 1200px;
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    height: auto;
    aspect-ratio: 16/9;
    min-height: 300px;
}

.chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, transparent, #4299e1, transparent);
    animation: waterWave 8s infinite linear;
}

#biteChart {
    width: 100% !important;
    height: 100% !important;
    max-height: none;
    min-height: 0;
    margin: 0 auto;
}

.section-description {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 25px auto;
    color: #4a5568;
    line-height: 1.6;
    animation: fadeIn 1s ease-out forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes waterWave {
    0% {
        left: -100%;
    }

    100% {
        left: 100%;
    }
}

.map-container {
    width: 100%;
    height: 300px;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
}

#map {
    width: 100%;
    height: 100%;
}

.coordinates-info {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    font-size: 14px;
    color: #4a5568;
}

.coordinates-info span {
    background: #f7fafc;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.date-cards {
    position: relative;
    width: 100%;
    padding: 0 40px;
    box-sizing: border-box;
    overflow: hidden;
}

.date-cards-container {
    display: flex;
    justify-content: flex-start;
    gap: 15px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding: 5px 0;
    padding-left: 15px;
    padding-right: 15px;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.date-cards-container::-webkit-scrollbar {
    display: none;
}

.date-card {
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    flex: 0 0 140px;
    min-width: 140px;
    -webkit-tap-highlight-color: transparent;
}

.date-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4299e1, #63b3ed);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.date-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.date-card:hover::before {
    opacity: 1;
}

.date-card.active {
    border-color: #4299e1;
    background-color: #ebf8ff;
}

.date-card.active::before {
    opacity: 1;
}

.scroll-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.scroll-button:hover {
    background: #f0f5f9;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.scroll-button.left {
    left: 5px;
}

.scroll-button.right {
    right: 5px;
}

.scroll-button svg {
    width: 16px;
    height: 16px;
    stroke: #2c5282;
    stroke-width: 2;
}

.date-label {
    font-size: 14px;
    color: #4a5568;
    margin-bottom: 8px;
    font-weight: 600;
}

.date-value {
    font-size: 16px;
    font-weight: 600;
    color: #2c5282;
}

.selection-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
    max-width: 1200px;
    padding: 0 20px;
}

.breed-selector,
.water-type-selector,
.location-selector {
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 250px;
    max-width: 300px;
}

.breed-selector label,
.water-type-selector label {
    display: block;
    margin-bottom: 8px;
    color: #2c5282;
    font-weight: 600;
}

.breed-selector select,
.water-type-selector select {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background-color: white;
    cursor: pointer;
}

.breed-selector select:focus,
.water-type-selector select:focus {
    border-color: #4299e1;
    outline: none;
}

.location-selector {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.location-selector .location-icon {
    width: 24px;
    height: 24px;
    color: #2c5282;
}

.location-selector .location-text {
    font-size: 14px;
    color: #4a5568;
    text-align: center;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #4a5568;
    padding: 5px;
    z-index: 1001;
}

.modal-close:hover {
    color: #2c5282;
}

.modal h2 {
    margin: 0;
    padding-bottom: 20px;
}

.modal-map-container {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    position: relative;
    flex-shrink: 0;
}

#modalMap {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.modal-coordinates {
    display: flex;
    gap: 20px;
    margin-bottom: 0;
}

.modal-coordinates input {
    flex: 1;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.modal-coordinates input:focus {
    border-color: #4299e1;
    outline: none;
}

.modal-save {
    background-color: #4299e1;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
}

.modal-save:hover {
    background-color: #3182ce;
}

#modalLat {
    width: 50%;
}

#modalLon {
    width: 50%;
}

@media (max-width: 1024px) {
    .main-content {
        padding: 0 15px;
        gap: 20px;
    }

    .section {
        padding: 20px;
    }

    .controls-row {
        gap: 15px;
    }

    .breed-selector,
    .water-type-selector,
    .location-selector {
        min-width: 200px;
        padding: 12px 20px;
    }

    .weather-info-container {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .date-cards {
        gap: 12px;
    }

    .date-card {
        padding: 12px;
    }
}

@media (max-width: 768px) {
    .header {
        height: auto;
        padding: 10px;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .back-button {
        position: static;
        margin: 0;
    }

    .page-header {
        font-size: 20px;
        padding: 0;
    }

    .main-content {
        margin-top: 120px;
        padding: 0 10px;
        gap: 15px;
    }

    .section {
        padding: 15px;
    }

    .section-title {
        font-size: 16px;
    }

    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .breed-selector,
    .water-type-selector,
    .location-selector {
        max-width: none;
        width: 100%;
        min-width: unset;
        padding: 10px 15px;
    }

    .weather-info-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .weather-info-column:nth-child(2) {
        order: -1;
    }

    .chart-item {
        min-height: 250px;
    }

    .date-cards {
        gap: 10px;
    }

    .date-card {
        padding: 10px;
    }

    .date-label {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .date-value {
        font-size: 14px;
    }

    .chart-container {
        padding: 15px 10px;
        aspect-ratio: 4/3;
    }
}

@media (max-width: 480px) {
    .main-content {
        margin-top: 110px;
        padding: 0 8px;
        gap: 12px;
    }

    .section {
        padding: 12px;
    }

    .date-cards {
        gap: 8px;
    }

    .date-card {
        padding: 8px;
    }

    .chart-item {
        min-height: 200px;
    }

    .chart-container {
        padding: 10px 5px;
        aspect-ratio: 1/1;
    }

    #biteChart {
        width: 100% !important;
        height: 100% !important;
    }

    .modal-content {
        padding: 15px;
    }

    .modal-map-container {
        height: 250px;
    }

    .section-description {
        margin-bottom: 15px;
        font-size: 14px;
    }
}

/* Ensure proper box-sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Fix for iOS Safari padding issues */
@supports (-webkit-touch-callout: none) {
    .header {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .main-content {
        padding-left: calc(env(safe-area-inset-left) + 10px);
        padding-right: calc(env(safe-area-inset-right) + 10px);
    }
}