/* Global Styles - Centralized CSS Variables */
/* FIXED: Consolidated all CSS variables here to eliminate duplicates */
:root {
    /* Primary colors */
    --primary-bg: #1a1a1a;
    --secondary-bg: #2d2d2d;
    --accent-color: #6366f1;
    --accent-hover: #7c7ff3;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --border-color: rgba(255, 255, 255, 0.1);

    /* Status colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;

    /* Glass-morphism */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(20px);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --shadow-color: rgba(0, 0, 0, 0.3);

    /* Layout & spacing - Dynamic sizing */
    --border-radius: clamp(8px, 1.5vw, 12px);
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    --min-touch-target: 44px; /* Mobile touch target */
    --spacing-xs: clamp(0.25rem, 1vw, 0.5rem);
    --spacing-sm: clamp(0.5rem, 2vw, 1rem);
    --spacing-md: clamp(1rem, 3vw, 2rem);
    --spacing-lg: clamp(1.5rem, 4vw, 3rem);
    --spacing-xl: clamp(2rem, 5vw, 4rem);

    /* Navigation specific - Responsive widths */
    --nav-width-expanded: min(240px, 25vw);
    --nav-width-collapsed: 60px;
    --nav-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --nav-item-height: 48px;

    /* FIXED: Standardized breakpoints for consistent responsive design */
    --breakpoint-xs: 480px;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --breakpoint-xxl: 1920px;
    
    /* Legacy colors (to be removed after refactor) */
    --primary-color: #6366f1;
    --secondary-color: #3a0ca3;
    --background-color: #1a1a1a;
    --text-color: #ffffff;
    --sidebar-bg: rgba(255, 255, 255, 0.05);
    --chat-bg: #242424;
    --message-bot-bg: #2a2a2a;
    --message-user-bg: #3a0ca3;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--primary-bg) 0%, var(--secondary-bg) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height */
    min-height: -webkit-fill-available; /* iOS Safari fix */
    overflow-x: hidden;
    overflow-y: auto;
    /* Smooth scrolling for better UX */
    scroll-behavior: smooth;
    /* Prevent text size adjustment on mobile */
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

/* Dynamic App Container */
.app-container {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height */
    min-height: -webkit-fill-available; /* iOS Safari fix */
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Three.js Background */
.three-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* FIXED: Removed legacy sidebar and navigation code - using enhanced navigation system */

/* FIXED: Added global touch-friendly sizing for mobile */
/* Minimum 44px touch targets for mobile accessibility */
button, 
.button, 
input[type="button"], 
input[type="submit"], 
a.button {
    min-height: var(--min-touch-target);
    min-width: var(--min-touch-target);
    padding: 12px 16px;
    touch-action: manipulation; /* Prevent double-tap zoom */
}

input[type="text"], 
input[type="email"], 
input[type="tel"], 
input[type="date"], 
input[type="time"], 
select, 
textarea {
    min-height: var(--min-touch-target);
    padding: 12px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
}

/* Ensure clickable icons are touch-friendly */
.icon-button, 
.nav-link, 
.clickable-icon {
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Profiles Section Header - Override inline styles */
.profiles-header {
    display: flex !important;
    justify-content: flex-start !important;  /* Override inline space-between */
    align-items: center !important;
    gap: 2rem !important;
    margin-bottom: 2rem !important;
    flex-wrap: wrap !important;
}

.profiles-header h1 {
    margin: 0 !important;
    margin-bottom: 0 !important;  /* Override inline margin */
    flex: 0 0 auto !important;
}

.profiles-header .button,
.profiles-header button {
    flex: 0 0 auto !important;
    margin-left: 0 !important;  /* Keep button close to title */
}

/* Mobile responsiveness for profiles header */
@media (max-width: 768px) {
    .profiles-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 1rem !important;
    }

    .profiles-header .button,
    .profiles-header button {
        width: 100% !important;
        margin-top: 0.5rem !important;
    }
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    min-height: 100vh;
}

/* Ensure sections fill the main content area */
.main-content > div {
    width: 100%;
    flex: 1;
}

/* Top Navigation */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #333;
}

.nav-section {
    display: flex;
    gap: 10px;
}

/* FIXED: Removed .nav-button legacy styles - replaced by enhanced navigation */

.settings-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-icon:hover {
    background-color: #333;
}

/* Nav Input Containers */
.nav-input-container {
    position: relative;
    padding: 8px 10px; /* Adjusted padding */
    background-color: transparent;
    border: 1px solid #333;
    border-radius: 20px;
    color: #888;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px; /* Increased gap */
    flex-wrap: wrap; /* Allow wrapping for absolute positioned elements */
}

.nav-input-container.active, /* Keep hover effect for when not editing */
.nav-input-container:not(.editing):hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    cursor: pointer;
}

.nav-input-container.editing {
    border-color: var(--accent-color); /* Highlight when editing */
    cursor: default;
}

.nav-input-label {
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-input-field {
    background-color: var(--sidebar-bg);
    color: var(--text-color);
    border: 1px solid #555;
    border-radius: 5px;
    padding: 6px 8px; /* Increased padding for better visibility */
    font-size: 14px;
    width: auto; 
    min-width: 100px; /* Ensure date input shows more */
}

.nav-input-field[type="date"],
.nav-input-field[type="time"] {
    min-width: 120px; /* Specific min-width for date/time */
    appearance: none; /* Remove default styling for date/time picker icon */
    -webkit-appearance: none;
}

#birth-city-input {
    min-width: 200px; /* Wider for full address display */
    max-width: 300px; /* Prevent it from being too wide */
    -moz-appearance: none;
}

/* Custom styling for date/time picker indicators if possible (browser dependent) */
.nav-input-field[type="date"]::-webkit-calendar-picker-indicator,
.nav-input-field[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0.6); /* Make the default icon lighter on dark background */
    cursor: pointer;
    margin-left: 4px;
}

.nav-input-field:read-only {
    background-color: transparent;
    border: 1px solid transparent;
    color: var(--text-color);
    padding-left: 0;
    min-width: fit-content; /* Allow readonly fields to shrink to content */
}

.nav-action-button {
    background-color: var(--accent-color);
    color: var(--background-color);
    border: none;
    border-radius: 5px;
    padding: 6px 10px; /* Increased padding */
    font-size: 13px; /* Slightly larger font */
    cursor: pointer;
    margin-left: 8px; /* Increased margin */
    transition: background-color 0.2s ease;
    white-space: nowrap; /* Prevent button text from wrapping */
}

.nav-action-button:hover {
    background-color: var(--primary-color);
    color: white;
}

#place-details-list {
    font-size: 0.85em;
    color: #b0b0b0;
    margin-top: 4px;
    margin-bottom: 0;
    padding-left: 0.5em;
    list-style: none;
    display: flex; /* Horizontal layout */
    flex-wrap: wrap;
    gap: 10px; /* Space between items */
}

#place-details-list li {
    margin: 0;
    padding: 0;
    font-size: 0.95em;
    display: inline-block; /* Horizontal stacking */
    white-space: nowrap; /* Prevent text wrapping */
}

/* Initial state: label visible, inputs and action buttons hidden */
.nav-input-container .nav-input-field,
.nav-input-container .nav-action-button {
    display: none;
}

/* Editing state: label hidden, inputs and submit button visible */
.nav-input-container.editing .nav-input-label {
    display: none;
}
.nav-input-container.editing .nav-input-field,
.nav-input-container.editing #submit-birth-date,
.nav-input-container.editing #submit-place {
    display: inline-block;
}

/* Submitted/Readonly state: label hidden, inputs (readonly) and edit button visible */
.nav-input-container.submitted .nav-input-label {
    display: none;
}
.nav-input-container.submitted .nav-input-field {
    display: inline-block;
}
/* Individual edit buttons are removed, so these specific selectors are no longer needed for them
.nav-input-container.submitted #edit-birth-date,
.nav-input-container.submitted #edit-place {
    display: inline-block;
}*/

.nav-actions-container {
    display: flex;
    align-items: center;
    margin-left: 10px; /* Space it from the input containers */
}


/* Content Area */
.content-area {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

/* Chat Section */
.chat-section {
    width: 50%;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    max-width: 80%;
    flex-shrink: 0; /* Prevent shrinking during content changes */
    flex-grow: 0; /* Prevent growing beyond set width */
    overflow: hidden; /* Ensure content doesn't break out */
}

/* Resizer */
.resizer {
    width: 8px;
    background: rgba(76, 201, 240, 0.5);
    cursor: col-resize;
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s ease;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.resizer:hover {
    background: rgba(76, 201, 240, 0.8);
    width: 10px;
}

.resizer.resizing {
    background: var(--accent-color);
    width: 10px;
}

.resizer.streaming-locked {
    background: rgba(76, 201, 240, 0.3);
    cursor: not-allowed;
    opacity: 0.6;
}

.resizer::before {
    content: '⋮⋮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    line-height: 0.8;
    letter-spacing: -2px;
    transition: all 0.3s ease;
}

.resizer:hover::before {
    color: rgba(255, 255, 255, 0.9);
}

.chat-container {
    background-color: var(--chat-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.chat-messages {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal expansion */
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 0; /* Allow container to shrink */
    width: 100%; /* Constrain to parent width */
    box-sizing: border-box; /* Include padding in width calculations */
}

.message {
    display: flex;
    gap: 10px;
    max-width: 100%; /* Use full container width */
    width: 100%; /* Ensure messages fill container */
    box-sizing: border-box;
}

.message.bot {
    align-self: flex-start;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--primary-color);
    flex-shrink: 0;
}

.message.user .message-avatar {
    background-color: var(--secondary-color);
}

.message-content {
    padding: 12px 15px;
    border-radius: 18px;
    background-color: var(--message-bot-bg);
    flex: 1; /* Take available space */
    min-width: 0; /* Allow shrinking */
    overflow-wrap: break-word; /* Break long words */
    word-break: break-word; /* Handle text overflow */
}

.message.user .message-content {
    background-color: var(--message-user-bg);
}

.message-content p {
    margin: 0;
    color: var(--text-color);
}

.chat-input {
    display: flex;
    padding: 15px;
    background-color: var(--chat-bg);
    border-top: 1px solid #333;
}

.chat-input input {
    flex-grow: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    background-color: #333;
    color: var(--text-color);
    outline: none;
}

.chat-input button {
    width: 40px;
    height: 40px;
    margin-left: 10px;
    border: none;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-input button:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}

/* Chart Section - Enhanced for Jyotishmitra Integration */
.chart-section {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    min-height: 600px;
    min-width: 300px;
    flex-shrink: 0; /* Prevent shrinking during content changes */
}

.chart-container {
    background-color: var(--chat-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
}

.chart-canvas {
    flex-grow: 1;
    background-color: #1a1a1a;
    position: relative;
    min-height: 400px;
    height: 100%;
    width: 100%;
    overflow: hidden;
    border-radius: var(--border-radius);
    /* Enhanced for 3D integration */
    perspective: 1000px;
    transform-style: preserve-3d;
}

.chart-canvas.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    border-radius: 0;
}

.chart-canvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.chart-details {
    padding: 15px;
    border-top: 1px solid #333;
}

.chart-details h3 {
    margin-bottom: 10px;
    color: var(--accent-color);
}

.chart-data {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.data-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

.data-row .label {
    color: #888;
}

.data-row .value {
    color: var(--text-color);
    font-weight: 500;
}

/* Rule Engine Results Table */
.rule-engine-summary {
    padding: 20px;
    border-top: 1px solid #333;
    background-color: var(--message-bot-bg);
    border-radius: var(--border-radius);
    margin-top: 10px;
}

.rule-engine-summary h4 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
}

.rule-engine-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background-color: var(--chat-bg);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.rule-engine-table th {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rule-engine-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #333;
    color: var(--text-color);
}

.rule-engine-table td:first-child {
    color: #888;
    font-weight: 500;
}

.rule-engine-table td:last-child {
    font-weight: 600;
    color: var(--accent-color);
    text-align: right;
}

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

.rule-engine-table tr:hover {
    background-color: rgba(67, 97, 238, 0.1);
}

.rule-engine-table tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Main Content Area - adjusted for sidebar */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: margin-right 0.3s ease; /* Smooth transition when sidebar appears/disappears */
    margin-right: 0; /* Default when sidebar is hidden */
}

.main-content.sidebar-visible {
    margin-right: 200px; /* Width of the profile sidebar */
}

/* Profile Sidebar */
.profile-sidebar {
    width: 200px;
    background-color: var(--sidebar-bg);
    padding: 20px;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
    position: fixed; /* Fixed position to slide over content or push it */
    right: 0;
    top: 0;
    height: 100%;
    transform: translateX(100%); /* Hidden by default */
    transition: transform 0.3s ease;
    z-index: 1000; /* Ensure it's above other content */
}

.profile-sidebar.visible {
    transform: translateX(0); /* Slide in */
}

.profile-header {
    padding-bottom: 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
}

.profile-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-option {
    padding: 10px;
    background-color: transparent;
    border: 1px solid #333;
    border-radius: 5px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.profile-option:hover {
    background-color: #333;
}

/* Responsive Design - Adjustments for sidebar behavior */
@media (max-width: 992px) {
    .content-area {
        flex-direction: column;
    }
    
    .chat-section,
    .chart-section {
        width: 100%;
        height: 50%;
    }
    
    /* On smaller screens, the sidebar might overlay content instead of pushing it */
    .main-content.sidebar-visible {
        margin-right: 0; /* No margin push on smaller screens if it overlays */
    }

    /* .profile-sidebar specific responsive styles can be added here if needed */
    /* For now, the default fixed positioning and transform work well. */
}

/* Mobile Responsive Design - iPhone and other mobile devices */
@media (max-width: 768px) {
    /* FIXED: Removed legacy .sidebar reference */
    
    /* Adjust main content to full width */
    .main-content {
        width: 100%;
    }
    
    /* Stack navigation vertically on mobile */
    .top-nav {
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }
    
    .nav-section {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    /* Make input containers full width and stack vertically */
    .nav-input-container {
        width: 100%;
        padding: 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .nav-input-container .nav-input-label {
        width: 100%;
        margin-bottom: 5px;
    }
    
    .nav-input-field {
        width: 100%;
        min-width: unset;
        max-width: none;
    }
    
    #birth-city-input {
        width: 100%;
        min-width: unset;
        max-width: none;
    }
    
    /* Place details below input */
    #place-details-list {
        position: relative;
        top: auto;
        margin-top: 8px;
        width: 100%;
    }
    
    /* Stack content areas vertically */
    .content-area {
        flex-direction: column;
        height: calc(100vh - 200px);
    }
    
    /* Chat section takes less height on mobile */
    /* FIXED: Optimized chat section for mobile full-screen display */
    .chat-section {
        width: 100%;
        height: calc(100vh - 60px); /* Full height minus mobile chrome */
        min-height: unset;
        padding: 0; /* Remove padding for full screen */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 50;
        max-width: 100%;
    }
    
    /* Chart section optimization for mobile */
    .chart-section {
        width: 100%;
        height: 60vh;
        padding: 10px;
    }
    
    /* Hide resizer on mobile */
    .resizer {
        display: none;
    }
    
    /* Optimize chart container for mobile */
    .chart-container {
        height: 100%;
    }
    
    .chart-canvas {
        min-height: 300px;
    }
    
    /* Make chart SVG responsive */
    .jyotishmitra-chart-wrapper {
        padding: 5px !important;
    }
    
    .jyotishmitra-chart-wrapper svg {
        width: 100% !important;
        height: auto !important;
        max-width: 100%;
    }
    
    /* Adjust chat interface for mobile */
    .chat-container {
        height: 100%;
    }
    
    .chat-messages {
        padding: 10px;
        font-size: 14px;
    }
    
    .chat-input {
        padding: 10px;
    }
    
    .chat-input input {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    /* Adjust message styling for mobile */
    .message-content {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .message-avatar {
        width: 30px;
        height: 30px;
    }
    
    /* Optimize modals for mobile */
    .auth-modal-content {
        padding: 20px;
        width: 95%;
        max-width: 350px;
    }
    
    .auth-modal-header h2 {
        font-size: 22px;
    }
    
    .auth-modal-header p {
        font-size: 14px;
    }
    
    .auth-option-btn {
        padding: 14px 18px;
        font-size: 14px;
    }
    
    .auth-option-btn i {
        font-size: 20px;
        width: 35px;
        margin-right: 15px;
    }
    
    .auth-option-btn small {
        font-size: 12px;
    }
    
    /* Profile sidebar as overlay on mobile */
    .profile-sidebar {
        width: 250px;
        max-width: 80%;
    }
    
    /* Navigation actions container */
    .nav-actions-container {
        width: 100%;
        justify-content: center;
        margin-left: 0;
        margin-top: 10px;
    }
    
    .nav-action-button {
        flex: 1;
        max-width: 150px;
    }
    
    /* Settings icon positioning */
    .settings-icon {
        position: absolute;
        top: 10px;
        right: 10px;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    /* Further optimize for very small screens */
    .top-nav {
        padding: 8px;
    }
    
    /* FIXED: Removed legacy .nav-button reference */
    
    .chat-section {
        height: 35vh;
        min-height: 200px;
    }
    
    .chart-section {
        height: 65vh;
    }
    
    /* Ensure chart is fully visible on small screens */
    .chart-canvas {
        padding: 5px;
    }
    
    /* Make suggestions list mobile-friendly */
    .suggestions-list {
        max-height: 150px;
        font-size: 14px;
    }
    
    .suggestion-item {
        padding: 10px;
    }
    
    /* Optimize validation messages */
    .validation-message {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    /* Chart type indicator adjustment */
    .chart-type-indicator {
        font-size: 10px !important;
        padding: 3px 6px !important;
    }
}

/* iPhone specific adjustments */
@media only screen 
  and (min-device-width: 375px) 
  and (max-device-width: 812px) 
  and (-webkit-device-pixel-ratio: 3) {
    /* iPhone X/XS/11 Pro specific styles */
    .app-container {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .top-nav {
        padding-top: calc(10px + env(safe-area-inset-top));
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .chat-section {
        height: 100%;
        width: 45%;
    }
    
    .chart-section {
        height: 100%;
        width: 55%;
    }
    
    .content-area {
        flex-direction: row;
    }
    
    .resizer {
        display: block;
    }
}

/* Validation Messages */
.validation-message {
    font-size: 12px;
    color: #ff4444;
    background-color: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 4px;
    padding: 4px 8px;
    margin-top: 4px;
    line-height: 1.3;
    animation: fadeInShake 0.3s ease-in-out;
}

@keyframes fadeInShake {
    0% {
        opacity: 0;
        transform: translateX(-5px);
    }
    50% {
        opacity: 1;
        transform: translateX(5px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Enhanced Chart Details */
.chart-details .chart-data {
    max-height: 400px;
    overflow-y: auto;
}

.chart-details .data-row {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
}

.chart-details .data-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    padding-left: 4px;
    padding-right: 4px;
}

.chart-details .data-row.chart-type {
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 12px;
}

.chart-details .data-row.birth-details {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px;
    margin-top: 12px;
}

.chart-details .label {
    font-weight: 600;
    color: var(--accent-color);
    min-width: 100px;
    display: inline-block;
}

.chart-details .value {
    color: var(--text-color);
    font-weight: 400;
}

/* Enhanced form validation states */
.nav-input-field:invalid {
    border-color: #ff4444;
    box-shadow: 0 0 5px rgba(255, 68, 68, 0.3);
}

.nav-input-field:valid {
    border-color: #4caf50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.nav-input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(67, 97, 238, 0.4);
}

/* Place suggestions styling */
.suggestions-list {
    position: fixed;
    background-color: var(--chat-bg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
}

.suggestion-item:hover {
    background-color: rgba(67, 97, 238, 0.2);
}

.suggestion-item:last-child {
    border-bottom: none;
}

/* Place details list */
.place-details-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
    font-size: 11px;
    color: #4caf50;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 4px;
    padding: 4px 8px;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex; /* Horizontal layout */
    flex-wrap: wrap;
    gap: 10px; /* Space between items */
}

.place-details-list li {
    margin: 2px 0;
    display: inline-block; /* Horizontal stacking */
    white-space: nowrap; /* Prevent text wrapping */
}

/* Enhanced Jyotishmitra Chart Styling */
.jyotishmitra-chart-wrapper {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    will-change: transform, box-shadow, opacity;
    /* Ensure full chart visibility */
    min-width: 100%;
    min-height: 100%;
    max-width: none;
    max-height: none;
}

.jyotishmitra-chart-wrapper:hover {
    transform: scale(1.02) translateZ(5px) !important;
}

.jyotishmitra-chart-wrapper svg {
    transition: filter 0.3s ease;
}

.jyotishmitra-chart-wrapper:hover svg {
    filter: 
        drop-shadow(0 6px 16px rgba(0, 0, 0, 0.25))
        brightness(1.08)
        contrast(1.12) !important;
}

.chart-type-indicator {
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
}

.jyotishmitra-chart-wrapper:hover .chart-type-indicator {
    background: linear-gradient(135deg, #4cc9f0 0%, #3a0ca3 100%) !important;
    transform: scale(1.05);
}

/* 3D Background Integration */
.three-background canvas {
    filter: brightness(0.7) contrast(1.2);
    transition: filter 0.5s ease;
}

.chart-canvas:hover + .three-background canvas,
.chart-section:hover .three-background canvas {
    filter: brightness(0.5) contrast(1.4);
}

/* Enhanced Chart Details for Jyotishmitra */
.chart-details .data-row.jyotishmitra-planet {
    background: linear-gradient(90deg, rgba(76, 201, 240, 0.05) 0%, rgba(67, 97, 238, 0.05) 100%);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
    padding: 8px 12px;
    margin: 2px 0;
    transition: all 0.2s ease;
}

.chart-details .data-row.jyotishmitra-planet:hover {
    background: linear-gradient(90deg, rgba(76, 201, 240, 0.1) 0%, rgba(67, 97, 238, 0.1) 100%);
    transform: translateX(2px);
}

/* Responsive design for validation */
@media (max-width: 768px) {
    .validation-message {
        font-size: 11px;
        padding: 3px 6px;
    }
    
    .nav-input-container {
        margin-bottom: 8px;
    }
    
    .jyotishmitra-chart-wrapper {
        padding: 10px !important;
    }
    
    .chart-type-indicator {
        top: 4px !important;
        right: 4px !important;
        font-size: 9px !important;
        padding: 4px 8px !important;
    }
}

/* Authentication Modal Styles */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.auth-modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-modal-header h2 {
    color: #fff;
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: 600;
}

.auth-modal-header p {
    color: #b8b8b8;
    font-size: 16px;
}

.auth-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.auth-option-btn {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 18px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
    font-size: 16px;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.auth-option-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.auth-option-btn i {
    font-size: 24px;
    width: 40px;
    margin-right: 20px;
    color: #4a9eff;
}

.auth-option-btn .fab.fa-google {
    color: #4285f4;
}

.auth-option-btn .fas.fa-envelope {
    color: #ea4335;
}

.auth-option-btn .fas.fa-user-secret {
    color: #34a853;
}

.auth-option-btn span {
    display: block;
    font-weight: 500;
    margin-bottom: 4px;
}

.auth-option-btn small {
    display: block;
    font-size: 13px;
    color: #b8b8b8;
    font-weight: 400;
}

.auth-modal-footer {
    text-align: center;
}

.auth-cancel-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #b8b8b8;
    padding: 10px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.auth-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

/* Email Authentication Form Styles */
.email-auth-form {
    padding: 20px 0;
}

.email-auth-form .form-group {
    margin-bottom: 20px;
}

.email-auth-form label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-size: 14px;
    font-weight: 500;
}

.email-auth-form .form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    transition: all 0.3s ease;
}

.email-auth-form .form-control:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.email-auth-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.auth-actions {
    margin: 25px 0;
}

.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.auth-switch {
    text-align: center;
    margin: 20px 0;
}

.auth-switch p {
    color: #b8b8b8;
    font-size: 14px;
}

.auth-switch a {
    color: #7c3aed;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.auth-switch a:hover {
    color: #9f7aea;
}

.auth-forgot {
    text-align: center;
    margin-top: 15px;
}

.auth-forgot a {
    color: #9ca3af;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.3s ease;
}

.auth-forgot a:hover {
    color: #7c3aed;
}

.error-message {
    padding: 10px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    font-size: 14px;
}

/* Logout Modal */
.logout-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001; /* Higher than auth modal */
    backdrop-filter: blur(5px);
}
