* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e8ba3 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #0066cc 0%, #004999 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.2em;
    margin-bottom: 10px;
    font-weight: 600;
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.95;
    font-weight: 300;
}

main {
    padding: 30px;
}

.info-box {
    background: #e3f2fd;
    border-left: 4px solid #0066cc;
    padding: 15px 20px;
    margin-bottom: 25px;
    border-radius: 5px;
}

.info-box p {
    color: #004999;
    font-size: 1.05em;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 1em;
    cursor: pointer;
    color: #666;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-btn:hover {
    color: #0066cc;
    background: #f5f9ff;
}

.tab-btn.active {
    color: #0066cc;
    border-bottom-color: #0066cc;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Date Selectors */
.date-selector, .date-range-selector {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.route-selectors {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    align-items: end;
    background: #f5f9ff;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #b3d9ff;
}

.route-arrow {
    font-size: 2em;
    color: #0066cc;
    font-weight: bold;
    padding-bottom: 8px;
    text-align: center;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.time-slot-selector {
    background: #fff8e1;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #ffb74d;
}

.time-slot-selector > label {
    font-weight: 600;
    color: #e65100;
    display: block;
    margin-bottom: 10px;
}

.time-inputs {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.time-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-input-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.95em;
}

.time-input-group input[type="time"] {
    padding: 8px 12px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.3s;
    background: white;
}

.time-input-group input[type="time"]:focus {
    outline: none;
    border-color: #ff9800;
}

.time-separator {
    font-size: 1.2em;
    color: #666;
    font-weight: bold;
}

.time-slot-display {
    background: #fff3e0;
    color: #e65100;
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 1em;
    font-weight: 600;
    border-left: 4px solid #ff9800;
}

.date-selector label,
.date-input-group label {
    font-size: 1em;
    font-weight: 600;
    color: #333;
}

#sailing-date,
#start-month,
#end-month,
#year-select {
    padding: 12px 15px;
    font-size: 1.05em;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
    background: white;
}

#sailing-date:focus,
#start-month:focus,
#end-month:focus,
#year-select:focus {
    outline: none;
    border-color: #0066cc;
}

.time-slot-info {
    background: #fff3e0;
    padding: 12px 15px;
    border-radius: 8px;
    border-left: 4px solid #ff9800;
}

.time-slot-info p {
    color: #e65100;
    font-size: 1.05em;
}

.btn-primary {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: 600;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 102, 204, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0066cc;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

/* Error Messages */
.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid #c62828;
    margin-bottom: 20px;
}

/* Results */
.results {
    margin-top: 30px;
}

.results h2 {
    color: #0066cc;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.selected-date {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 10px;
    font-weight: 600;
}

.route-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #0d47a1;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 1.05em;
    font-weight: 700;
    border-left: 4px solid #1976d2;
}

.harbor-info {
    background: #e1f5fe;
    color: #01579b;
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.95em;
    font-weight: 600;
    border-left: 4px solid #0277bd;
}

.timing-info {
    background: #fff3e0;
    color: #e65100;
    padding: 10px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.95em;
    font-weight: 600;
    border-left: 4px solid #ff9800;
}

.results-count {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 15px;
    border-left: 4px solid #4caf50;
}

.tide-shift-info {
    background: #e3f2fd;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid #2196f3;
}

.tide-shift-info p {
    color: #1565c0;
    font-size: 0.95em;
    margin: 0;
}

.weekend-group-header {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.1em;
    margin: 25px 0 15px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-shift {
    background: #bbdefb;
    color: #0d47a1;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 600;
    margin: 0 5px;
}

/* Weekend Summary */
.weekend-summary {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border: 2px solid #ffb74d;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.weekend-summary h3 {
    color: #e65100;
    margin: 0 0 15px 0;
    font-size: 1.3em;
    text-align: center;
}

.saturday-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.saturday-item {
    background: white;
    border: 2px solid #ff9800;
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.saturday-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.saturday-number {
    background: #ff9800;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9em;
    flex-shrink: 0;
}

.saturday-date {
    flex: 1;
    font-weight: 600;
    color: #333;
    font-size: 0.95em;
}

.saturday-time {
    background: #4caf50;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-weight: 700;
    font-size: 0.95em;
    flex-shrink: 0;
}

.no-data {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Tide Cards */
.tide-card {
    background: linear-gradient(135deg, #f5f9ff 0%, #e8f4ff 100%);
    border: 2px solid #b3d9ff;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tide-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 102, 204, 0.2);
}

.tide-card.preferred {
    background: linear-gradient(135deg, #f1f8e9 0%, #dcedc8 100%);
    border-color: #9ccc65;
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.2);
}

.tide-card.preferred:hover {
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.3);
}

.tide-number {
    font-size: 0.9em;
    color: #0066cc;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

.tide-card.preferred .tide-number {
    color: #388e3c;
}

.tide-details {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.time-info, .departure-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.label {
    font-weight: 600;
    color: #555;
    min-width: 120px;
}

.time {
    font-size: 1.3em;
    font-weight: 700;
    color: #333;
}

.height {
    background: #0066cc;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.departure-time {
    font-size: 1.5em;
    font-weight: 700;
    color: #ff6f00;
    background: #fff3e0;
    padding: 5px 15px;
    border-radius: 8px;
}

.departure-time.in-slot {
    color: #2e7d32;
    background: #e8f5e9;
}

.out-of-slot {
    background: #ffebee;
    color: #c62828;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.ideal-badge {
    background: #4caf50;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
}

/* Explanation Box */
.explanation {
    background: #fff8e1;
    border-left: 4px solid #ffa726;
    padding: 20px;
    margin-top: 30px;
    border-radius: 5px;
}

.explanation h3 {
    color: #f57c00;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.explanation p {
    color: #555;
    line-height: 1.6;
}

/* Footer */
footer {
    background: #f5f5f5;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
    border-top: 1px solid #ddd;
}

/* Responsive Design */
@media (max-width: 600px) {
    header h1 {
        font-size: 1.6em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    main {
        padding: 20px;
    }
    
    .route-selectors {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .route-arrow {
        transform: rotate(90deg);
        font-size: 1.5em;
        padding: 0;
    }
    
    .time-inputs {
        flex-direction: column;
        align-items: stretch;
    }
    
    .time-separator {
        transform: rotate(90deg);
        font-size: 1em;
    }
    
    .tabs {
        flex-direction: column;
        gap: 0;
    }
    
    .tab-btn {
        border-bottom: 1px solid #e0e0e0;
        border-left: 3px solid transparent;
    }
    
    .tab-btn.active {
        border-bottom-color: #e0e0e0;
        border-left-color: #0066cc;
    }
    
    .time-info, .departure-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .label {
        min-width: auto;
    }
    
    .departure-time {
        font-size: 1.3em;
    }
}
