/* Modern Premium Dark Ocean Design System for TideTracker */

:root {
    --bg-base: #030712;
    --bg-surface: rgba(15, 23, 42, 0.65);
    --bg-surface-hover: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-focus: rgba(6, 182, 212, 0.4);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --color-primary: #06b6d4;      /* Teal/Cyan */
    --color-primary-hover: #0891b2;
    --color-primary-rgb: 6, 182, 212;
    
    --color-high-tide: #fbbf24;    /* Gold */
    --color-high-tide-rgb: 251, 191, 36;
    
    --color-low-tide: #60a5fa;     /* Soft Blue */
    --color-low-tide-rgb: 96, 165, 250;
    
    --color-error: #ef4444;
    --color-success: #10b981;
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px 2px rgba(6, 182, 212, 0.15);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

/* Background Glow Blobs */
.bg-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

.bg-glow-1 {
    top: -200px;
    right: -100px;
    background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
}

.bg-glow-2 {
    bottom: -200px;
    left: -100px;
    background: radial-gradient(circle, #4f46e5 0%, transparent 70%);
}

/* Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Glass Card */
.card {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

/* App Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    width: 48px;
    height: 48px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.25);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.logo-icon {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

h1 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.75rem;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, #fff 40%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Unit Toggle */
.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
}

.toggle-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: color var(--transition-fast);
}

.toggle-label.active {
    color: var(--text-primary);
}

.switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked + .slider {
    background-color: var(--color-primary);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Search Section */
.search-section {
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.search-bar-wrapper {
    display: flex;
    gap: 0.75rem;
}

.input-wrapper {
    position: relative;
    flex-grow: 1;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    height: 48px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 1rem 0 2.75rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.clear-btn {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-btn:hover {
    color: var(--text-primary);
}

.clear-btn.hidden {
    display: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    padding: 0 1.5rem;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--color-primary);
    color: #000;
    border: none;
    font-weight: 600;
}

.btn-primary:hover {
    background: #22d3ee;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.3);
}

.btn-secondary {
    background: rgba(30, 41, 59, 0.5);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(51, 65, 85, 0.5);
    border-color: var(--text-secondary);
}

/* Separator */
.or-separator {
    display: flex;
    align-items: center;
    margin: 1.25rem 0;
}

.or-separator .line {
    flex-grow: 1;
    height: 1px;
    background: var(--border-color);
}

.or-separator .text {
    padding: 0 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Station Dropdown */
.station-dropdown-wrapper {
    position: relative;
}

.dropdown-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}

#stationSelect {
    width: 100%;
    height: 48px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 1rem 0 2.75rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

#stationSelect:focus {
    outline: none;
    border-color: var(--color-primary);
}

.station-dropdown-wrapper::after {
    content: '';
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-25%) rotate(45deg);
    width: 6px;
    height: 6px;
    border-right: 2px solid var(--text-secondary);
    border-bottom: 2px solid var(--text-secondary);
    pointer-events: none;
}

/* Alerts */
.alert-container {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-container.hidden {
    display: none;
}

.alert-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-icon {
    color: var(--color-error);
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

#alertMessage {
    color: #fca5a5;
    font-size: 0.9rem;
}

.alert-close {
    background: transparent;
    border: none;
    color: #fca5a5;
    cursor: pointer;
    padding: 2px;
    display: flex;
}

.alert-close:hover {
    color: white;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-grid.hidden {
    display: none;
}

.panel-left, .panel-right {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Cards Inner Styling */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.card-header h2 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Current Tide Card */
.current-tide-card {
    position: relative;
    overflow: hidden;
    height: 320px;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    letter-spacing: 0.05em;
}

.ping-dot {
    width: 6px;
    height: 6px;
    background-color: var(--color-success);
    border-radius: 50%;
    animation: pulse-ping 1.5s infinite;
}

.tide-display {
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    position: relative;
    z-index: 2;
}

.tide-value-container {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.tide-height {
    font-size: 4rem;
    font-weight: 700;
    font-family: var(--font-heading);
    line-height: 1;
    letter-spacing: -0.03em;
}

.tide-unit {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.tide-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.25rem 0.65rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.trend-icon {
    width: 14px;
    height: 14px;
}

.tide-trend.rising {
    color: #22d3ee;
}
.tide-trend.falling {
    color: #a78bfa;
}

.next-event {
    margin: 0.75rem 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.event-indicator {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.event-icon {
    width: 12px;
    height: 12px;
}

.event-details {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.event-countdown {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--color-primary);
}

.event-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Wave Simulation Graphic */
.water-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.05) 0%, rgba(6, 182, 212, 0.2) 100%);
    border-top: 1px solid rgba(6, 182, 212, 0.15);
    z-index: 1;
    overflow: hidden;
    transition: height 1s ease-in-out;
}

.water-level {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.wave {
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M321.39,56.44c58-10.79,114.16-30.13,172-41.86,82.39-16.72,168.19-17.73,250.45-.39C823.78,31,906.67,72,985.66,92.83c70.05,18.48,146.53,26.09,214.34,3V120H0V0C26.9,8.75,55.05,16.22,83.1,22.07,143.7,34.72,206.1,43.21,268.07,49.25,285.81,51,303.65,53.84,321.39,56.44Z' style='fill: rgba(6, 182, 212, 0.12)'%3E%3C/path%3E%3C/svg%3E") repeat-x;
    position: absolute;
    top: -24px;
    width: 2400px;
    height: 30px;
    animation: wave-motion 12s cubic-bezier(0.36, 0.45, 0.63, 0.53) infinite;
    transform: translate3d(0, 0, 0);
}

.wave:nth-of-type(2) {
    top: -18px;
    animation: wave-motion-reverse 8s ease infinite;
    opacity: 0.6;
}

/* Tide Tables Styling */
.tide-table-card {
    flex-grow: 1;
}

.date-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
}

.calendar-icon {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

#dateSelect {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    cursor: pointer;
}

#dateSelect:focus {
    outline: none;
}

#dateSelect::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
}

.table-container {
    padding: 0.75rem;
}

.tide-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.tide-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.tide-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.tide-table tr:last-child td {
    border-bottom: none;
}

.tide-table tr.row-today {
    background: rgba(6, 182, 212, 0.03);
}

.loading-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 0 !important;
}

/* Tide Type Badge */
.tide-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.tide-badge.high {
    color: var(--color-high-tide);
    background: rgba(251, 191, 36, 0.1);
}

.tide-badge.low {
    color: var(--color-low-tide);
    background: rgba(96, 165, 250, 0.1);
}

.tide-badge i {
    width: 12px;
    height: 12px;
}

.height-cell {
    font-weight: 600;
    font-family: var(--font-heading);
}

.height-cell.high {
    color: var(--color-high-tide);
}

.height-cell.low {
    color: var(--color-low-tide);
}

.day-cell {
    font-weight: 500;
}

.day-cell .date-muted {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    display: block;
}

/* Tide Graph / Chart Card */
.chart-card {
    flex-grow: 1;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

.chart-legend {
    display: flex;
    gap: 1rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.legend-color.height-color {
    background-color: var(--color-primary);
}

.legend-color.current-color {
    background-color: var(--color-high-tide);
}

.chart-container {
    flex-grow: 1;
    padding: 1.5rem;
    position: relative;
    height: 280px;
    width: 100%;
}

/* Station Details Card */
.details-list {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.details-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.details-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.details-item.hidden {
    display: none;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.detail-value {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: right;
}

.detail-value.code {
    font-family: monospace;
    color: var(--text-secondary);
}

.text-highlight {
    color: var(--color-primary);
    font-weight: 600;
}

/* Welcome Panel */
.welcome-panel {
    padding: 4rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.welcome-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    color: var(--color-primary);
    filter: drop-shadow(var(--shadow-glow));
}

.welcome-panel h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.welcome-panel p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.welcome-panel .actions {
    margin-top: 0.5rem;
}

.quick-links {
    margin-top: 1.5rem;
    width: 100%;
}

.quick-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted) !important;
    margin-bottom: 0.75rem;
}

.chips-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.chip {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.4rem 0.85rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chip:hover {
    background: rgba(6, 182, 212, 0.1);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--color-primary);
    transform: translateY(-1px);
}

/* App Footer */
.app-footer {
    margin-top: auto;
    padding: 2rem 0 1rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.app-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Animations */
@keyframes pulse-ping {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

@keyframes wave-motion {
    0% {
        transform: translateX(0) translateZ(0) scaleY(1);
    }
    50% {
        transform: translateX(-25%) translateZ(0) scaleY(0.9);
    }
    100% {
        transform: translateX(-50%) translateZ(0) scaleY(1);
    }
}

@keyframes wave-motion-reverse {
    0% {
        transform: translateX(-50%) translateZ(0) scaleY(0.95);
    }
    50% {
        transform: translateX(-25%) translateZ(0) scaleY(1.05);
    }
    100% {
        transform: translateX(0) translateZ(0) scaleY(0.95);
    }
}

.animate-wave {
    animation: rotate-rock 3s ease-in-out infinite;
}

@keyframes rotate-rock {
    0%, 100% { transform: rotate(-5deg) translateY(0); }
    50% { transform: rotate(5deg) translateY(-2px); }
}

.animate-pulse {
    animation: heart-pulse 2s infinite ease-in-out;
}

@keyframes heart-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

/* Responsive Adaptations */
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .panel-left, .panel-right {
        gap: 1.5rem;
    }
    
    .current-tide-card {
        height: 280px;
    }
}

@media (max-width: 600px) {
    .app-container {
        padding: 1rem;
    }
    
    .app-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .controls-group {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }
    
    .search-bar-wrapper {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .welcome-panel h2 {
        font-size: 1.5rem;
    }
    
    .tide-height {
        font-size: 3rem;
    }
}
