/* Modern Weather App Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #ffffff;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 25%, #0891b2 75%, #0e7490 100%);
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
    /* Mobile optimizations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    /* Safe area support */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
}

/* Glass Card Effect */
.glass-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* Navigation Tabs */
.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* Mobile: Larger touch targets */
@media (max-width: 768px) {
    .nav-tab {
        padding: 14px 12px;
        min-width: 60px;
        min-height: 64px;
    }
    
    .nav-tab:active {
        transform: scale(0.95);
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Enhanced Chart Styles */
.chart-container {
    position: relative;
    width: 100%;
    min-height: 300px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.chart-container:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.chart-container canvas {
    max-height: 100% !important;
}

.historical-charts-container {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

.precipitation-chart-wrapper {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
}

/* Chart loading state */
.chart-container.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.chart-container.loading::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: rgba(59, 130, 246, 1);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Chart tooltip enhancements */
.chartjs-tooltip {
    background: rgba(15, 23, 42, 0.95) !important;
    border-radius: 8px !important;
    padding: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* Responsive chart adjustments */
@media (max-width: 768px) {
    .chart-container {
        min-height: 250px;
        padding: 12px;
    }
    
    .historical-charts-container {
        padding: 16px !important;
    }
    
    .precipitation-chart-wrapper {
        padding: 16px !important;
    }
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.nav-tab.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.nav-tab span:first-child {
    font-size: 1.5rem;
}

.nav-tab span:last-child {
    font-size: 0.75rem;
    font-weight: 500;
}

/* Mobile: Larger icons and text */
@media (max-width: 768px) {
    .nav-tab span:first-child {
        font-size: 1.75rem;
    }
    
    .nav-tab span:last-child {
        font-size: 0.7rem;
        font-weight: 600;
    }
}

/* Touch manipulation utility */
.touch-manipulation {
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
    user-select: none;
    -webkit-user-select: none;
}

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Mobile header improvements */
@media (max-width: 768px) {
    #main-header {
        padding-top: calc(1rem + env(safe-area-inset-top, 0px));
    }
    
    #main-header h1 {
        font-size: 1.5rem;
    }
    
    #main-header button {
        font-size: 0.875rem;
        padding: 0.75rem 1rem;
    }
}

/* Better button sizes on mobile */
@media (max-width: 768px) {
    button {
        min-height: 48px;
        min-width: 48px;
    }
    
    button:active {
        transform: scale(0.97);
    }
}

/* Improve text readability on mobile */
@media (max-width: 768px) {
    .glass-card {
        font-size: 1rem;
        line-height: 1.7;
    }
    
    .glass-card h2,
    .glass-card h3 {
        font-size: 1.25rem;
        line-height: 1.4;
    }
}

/* Smooth scrolling on mobile */
@media (max-width: 768px) {
    * {
        -webkit-overflow-scrolling: touch;
    }
    
    .screen {
        scroll-behavior: smooth;
    }
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Chat Interface Styles */
.chat-container {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 1rem;
    max-height: 300px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    visibility: visible;
}

.chat-message {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 12px;
    max-width: 80%;
    animation: slideIn 0.3s ease-out;
    word-wrap: break-word;
    display: block;
    visibility: visible;
    opacity: 1;
}

.chat-message.user {
    background: rgba(59, 130, 246, 0.3);
    margin-left: auto;
    text-align: right;
    color: white;
}

.chat-message.assistant {
    background: rgba(168, 85, 247, 0.3);
    margin-right: auto;
    color: white;
}

.chat-message .message-content {
    color: inherit;
    display: block;
    visibility: visible;
    opacity: 1;
}

.chat-message.typing {
    background: rgba(168, 85, 247, 0.2);
    margin-right: auto;
    color: white;
}

.chat-message.typing .message-content {
    display: flex;
    align-items: center;
    gap: 4px;
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    border-color: rgba(168, 85, 247, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.chat-send-btn {
    padding: 0.75rem;
    background: linear-gradient(135deg, #a855f7, #9333ea);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.chat-send-btn:hover {
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.chat-send-btn:active {
    transform: translateY(0);
}

.chat-send-btn.recording {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.35);
}

.voice-status-indicator {
    position: absolute;
    bottom: 60px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 20px;
    color: white;
    font-size: 12px;
    z-index: 10;
}

.voice-status-indicator.hidden {
    display: none;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
    display: block;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Live Data Styles */
#live-clock {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #06b6d4;
}

#live-date {
    font-family: 'Courier New', monospace;
    color: #94a3b8;
}

#current-location {
    color: #06b6d4;
    font-weight: 500;
}

/* Weather Icons and Animations */
.weather-icon {
    font-size: 2rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .nav-tab {
        padding: 8px 12px;
        min-width: 60px;
    }
    
    .nav-tab span:first-child {
        font-size: 1.25rem;
    }
    
    .nav-tab span:last-child {
        font-size: 0.7rem;
    }
    
    .glass-card {
        margin-bottom: 1rem;
    }
    
    .chat-container {
        height: 300px;
    }
    
    .chat-messages {
        max-height: 200px;
    }
}

@media (max-width: 480px) {
    .nav-tab {
        padding: 6px 8px;
        min-width: 50px;
    }
    
    .nav-tab span:first-child {
        font-size: 1rem;
    }
    
    .nav-tab span:last-child {
        font-size: 0.65rem;
    }
    
    .glass-card {
        padding: 1rem;
    }
    
    .chat-container {
        height: 250px;
    }
}

/* Loading States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #06b6d4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Tide Toggle Buttons */
.tide-toggle-btn {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
}

.tide-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.tide-toggle-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
}

/* Location Button */
#location-button:hover {
    background: rgba(6, 182, 212, 0.3);
    transform: translateY(-1px);
}

#location-button:active {
    transform: translateY(0);
}

/* Focus States */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #06b6d4;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .glass-card {
        background: rgba(0, 0, 0, 0.8);
        border: 2px solid white;
    }
    
    .nav-tab {
        background: rgba(0, 0, 0, 0.8);
        border: 2px solid white;
    }
}

/* Light Mode Styles */
body.light-mode {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 25%, #7dd3fc 75%, #38bdf8 100%);
    color: #1e3a8a;
}

body.light-mode .glass-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(30, 58, 138, 0.2);
    color: #1e3a8a;
}

body.light-mode .nav-tab {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(30, 58, 138, 0.2);
    color: #1e3a8a;
}

body.light-mode .nav-tab.active {
    background: rgba(30, 58, 138, 0.2);
    border-color: rgba(30, 58, 138, 0.4);
}

body.light-mode #main-header {
    background: rgba(255, 255, 255, 0.8);
    border-bottom-color: rgba(30, 58, 138, 0.2);
    color: #1e3a8a;
}

body.light-mode .data-source-footer {
    background: rgba(255, 255, 255, 0.9);
    border-top-color: rgba(30, 58, 138, 0.2);
    color: #1e3a8a;
}

body.light-mode .data-source-item {
    background: rgba(30, 58, 138, 0.1);
    color: #1e3a8a;
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .glass-card {
        background: white;
        border: 1px solid black;
        box-shadow: none;
    }
    
    .nav-tab {
        display: none;
    }
    
    .screen {
        display: block !important;
    }
}

/* ============================================
   Harwood UI Dashboard - Bottom Overlay
   ============================================ */

.harwood-dashboard-container {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 95vw;
    max-width: 48rem; /* 3xl */
    z-index: 30;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
}

.harwood-cards-container {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    pointer-events: auto;
}

.harwood-card {
    background: linear-gradient(to bottom right, rgb(15 23 42), rgb(30 41 59), rgb(2 6 23));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    max-width: 28rem; /* xl */
    width: 100%;
    pointer-events: auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.harwood-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.harwood-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.harwood-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: rgb(125 211 252); /* sky-300 */
    margin: 0;
}

.harwood-card-badge {
    font-size: 0.6875rem; /* 11px */
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background: rgba(14 116 144 / 0.6); /* sky-900/60 */
    color: rgb(186 230 253); /* sky-200 */
}

.harwood-card-sections {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.harwood-section {
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.625rem 0.75rem;
    background: rgba(15 23 42 / 0.6); /* slate-900/60 */
}

.harwood-section-info {
    border-color: rgba(255, 255, 255, 0.1);
}

.harwood-section-warning {
    border-color: rgb(250 204 21); /* yellow-400 */
    border-width: 2px;
}

.harwood-section-critical {
    border-color: rgb(239 68 68); /* red-500 */
    border-width: 2px;
}

.harwood-section-heading {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgb(186 230 253); /* sky-200 */
    margin-bottom: 0.25rem;
}

.harwood-section-content {
    font-size: 0.875rem;
    color: rgb(241 245 249); /* slate-100 */
    white-space: pre-line;
    line-height: 1.5;
}

.harwood-section-content strong {
    font-weight: 600;
    color: rgb(255, 255, 255);
}

.harwood-section-content em {
    font-style: italic;
    color: rgb(203 213 225); /* slate-300 */
}

.harwood-section-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8125rem;
}

.harwood-section-timestamp {
    margin-top: 0.25rem;
    font-size: 0.6875rem; /* 11px */
    color: rgb(148 163 184); /* slate-400 */
}

.harwood-card-footer {
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.75rem;
    color: rgb(203 213 225); /* slate-300 */
}

.harwood-note-container {
    pointer-events: auto;
    border-radius: 1rem;
    background: rgba(2 6 23 / 0.9); /* slate-950/90 */
    border: 1px solid rgba(14 116 144 / 0.6); /* sky-900/60 */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    padding: 0.75rem;
    font-size: 0.75rem;
    color: rgb(241 245 249); /* slate-100 */
    max-width: 28rem; /* xl */
    margin: 0 auto;
}

.harwood-note-title {
    font-weight: 600;
    color: rgb(125 211 252); /* sky-300 */
    margin-bottom: 0.25rem;
}

.harwood-note-content {
    color: rgb(241 245 249); /* slate-100 */
    line-height: 1.5;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .harwood-dashboard-container {
        bottom: 0.5rem;
        width: 98vw;
        gap: 0.5rem;
    }
    
    .harwood-cards-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .harwood-card {
        max-width: 100%;
        padding: 0.875rem 1rem;
    }
    
    .harwood-note-container {
        max-width: 100%;
        padding: 0.625rem;
        font-size: 0.6875rem;
    }
}

/* Ensure dashboard doesn't interfere with map interactions */
.harwood-dashboard-container * {
    user-select: text;
}

/* Animation for card appearance */
@keyframes harwoodCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.harwood-card {
    animation: harwoodCardFadeIn 0.3s ease-out;
}