/* Site Structure */
#content {
    display: flex;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    gap: 2rem;
    position: relative;
    box-sizing: border-box;
}

#primary.content-area {
    flex: 1;
    min-width: 0;
    width: calc(70% - 1rem);
    position: relative;
    box-sizing: border-box;
}

#secondary.sidebar {
    width: calc(30% - 1rem);
    position: relative;
    box-sizing: border-box;
}

/* Form styling */
.tide-search-form {
    background-color: #242551;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label,
.form-group-dates label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #ffffff;
}

.form-group select,
.form-group-dates input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #4a4b7c;
    border-radius: 0.25rem;
    background-color: #2f3163;
    color: #ffffff;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-group-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
    overflow: hidden;
}

.form-group-dates > div {
    width: 100%;
}

/* Main container styles */
.tide-calendar-container {
    background-color: #1a1b3a;
    color: #ffffff;
    padding: 2rem;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    box-sizing: border-box;
}

/* Title styling */
.tide-calendar-container .entry-title {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    text-align: center;
}

/* Button styling */
.button {
    background-color: #3157dc;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.button:hover {
    background-color: #4169e1;
}

/* Calendar display styling */
.tide-calendar {
    margin-top: 2rem;
}

.tide-day {
    background-color: #242551;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.tide-day h2 {
    color: #ffffff;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #4a4b7c;
    padding-bottom: 0.5rem;
}

.tide-times {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.high-tides,
.low-tides {
    background-color: #2f3163;
    padding: 1rem;
    border-radius: 0.25rem;
}

.tide-times h3 {
    color: #ffffff;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.tide-entry {
    background-color: #1a1b3a;
    padding: 0.75rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

/* Print button styling */
.print-button {
    text-align: center;
    margin: 2rem 0;
}

.print-button button {
    margin-bottom: 1rem; /* Adds space between buttons */
}

.button-wrapper {
    margin-bottom: 1rem; /* Adds space to each button */
}

/* Disclaimer styling */
.tide-disclaimer {
    margin-top: 2rem;
    padding: 1rem;
    background-color: #242551;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: #a0a0c0;
}

.tide-disclaimer p {
    margin: 0.5rem 0;
}

/* Error message styling */
.tide-error-message {
    background-color: #442222;
    border: 1px solid #662222;
    color: #ff9999;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.25rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3; /* Light grey */
    border-top: 5px solid #3157dc; /* Blue */
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media screen and (max-width: 960px) {
    #content {
        flex-direction: column;
        padding: 1rem;
    }

    #primary.content-area,
    #secondary.sidebar {
        width: 100% !important;
        margin: 0;
        padding: 0;
        float: none !important;
    }
    
    #secondary.sidebar {
        margin-top: 2rem !important;
        display: block !important;
        visibility: visible !important;
        clear: both;
    }

    .widget-container {
        display: block !important;
        margin-bottom: 1rem !important;
        width: 100% !important;
    }

    .tide-calendar-container {
        padding: 1rem;
        margin: 0;
        width: 100%;
        box-sizing: border-box;
    }
}

@media screen and (max-width: 640px) {
    .form-group-dates {
        grid-template-columns: 1fr;
        gap: 1rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .tide-times {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Add these print-specific styles */
@media print {
    .tide-day {
        page-break-inside: avoid;  /* Prevent cards from splitting across pages */
        break-inside: avoid;       /* Modern browsers */
    }

    .tide-search-form {
        page-break-after: avoid;   /* Keep form with first result */
        break-after: avoid;
    }

    .tide-calendar {
        page-break-before: auto;   /* Allow breaks between days */
        break-before: auto;
    }

    /* Hide print button when printing */
    .print-button {
        display: none !important;
    }
}