 /* 🔧 CRITICAL FIX: Master rule to fix line break display */
.ai-message,
.ai-message *,
.ai-message p,
.ai-message div {
    white-space: pre-line !important;
    line-height: 1.6 !important;
}

.ai-message p {
    margin: 0 0 8px 0 !important;
    display: block !important;
}

.ai-message p:last-child {
    margin-bottom: 0 !important;
}
 
 /* Main Global Styles - Enhanced Version */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.main-content {
    padding: 20px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Section Management */
.section {
    display: none;
}

.section.active {
    display: block;
}

/* Enhanced Container Layout */
.container {
    max-width: 900px;
    margin: 20px auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    position: relative;
}

/* Enhanced Header with Animation */
.header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: shimmer 4s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%); }
    100% { transform: translateX(100%) translateY(100%); }
}

.header h1 {
    font-size: 2.8em;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header p {
    opacity: 0.95;
    font-size: 1.2em;
    position: relative;
    z-index: 1;
    font-weight: 300;
}

/* 🔧 IMPROVED: Enhanced Status Bar - Hidden by Default */
.status {
    padding: 12px 20px;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    font-size: 14px;
    font-weight: 500;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 1px solid #e0e6ed;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    
    /* 🆕 NEW: Hidden by default */
    opacity: 0;
    transform: translateY(10px);
    visibility: hidden;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* 🆕 NEW: Show status when active */
.status.active {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    max-height: 60px;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Status message styling based on type */
.status.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-top-color: #c3e6cb;
}

.status.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-top-color: #f5c6cb;
}

.status.loading {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border-top-color: #bee5eb;
}

/* Enhanced History Section */
.history-section {
    padding: 30px;
    background: white;
    border-top: 1px solid #e0e6ed;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.history-header h3 {
    color: #2c3e50;
    font-size: 1.4em;
    font-weight: 600;
    margin: 0;
}

.history-controls {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Enhanced Print Button */
.print-history-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.2);
}

.print-history-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.print-history-btn:hover::before {
    left: 100%;
}

.print-history-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4);
}

.print-history-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Enhanced Clear History Button */
.clear-history-btn {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.2);
}

.clear-history-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.clear-history-btn:hover::before {
    left: 100%;
}

.clear-history-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(220, 53, 69, 0.4);
}

/* Enhanced History Container */
#historyContainer {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e6ed;
    border-radius: 15px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    scroll-behavior: smooth;
}

#historyContainer::-webkit-scrollbar {
    width: 8px;
}

#historyContainer::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
}

#historyContainer::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 4px;
}

#historyContainer::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #3a9bfd 0%, #00d9fd 100%);
}

/* Enhanced Conversation Display */
.conversation {
    border: 1px solid #e0e6ed;
    border-radius: 15px;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.conversation:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.conversation-date {
    font-size: 12px;
    color: #4facfe;
    margin-bottom: 12px;
    font-weight: 600;
}

.conversation-mood {
    display: inline-block;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    margin-bottom: 12px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(79, 172, 254, 0.3);
}

.conversation-messages {
    font-size: 16px;
}

.user-msg {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 12px 18px;
    border-radius: 18px 18px 5px 18px;
    margin-bottom: 10px;
    display: inline-block;
    max-width: 85%;
    margin-left: auto;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
    word-wrap: break-word;
    font-size: 16px;
}

/* Fix CBT formatting for the correct class used in chat */
.ai-message {
    white-space: pre-line !important;
    line-height: 1.7 !important;
}

/* Better spacing for CBT emoji sections */

.ai-msg {
    background: white;
    border: 1px solid #e0e6ed;
    padding: 12px 18px;
    border-radius: 18px 18px 18px 5px;
    display: block;
    margin-bottom: 15px;
    max-width: 85%;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 16px;
}

/* Enhanced Loading States */
.loading {
    display: none;
    text-align: center;
    color: #4facfe;
    padding: 25px;
    font-size: 16px;
    font-weight: 500;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e0e6ed;
    border-top-color: #4facfe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Print-specific styles */
@media print {
    /* Hide everything by default */
    body * {
        visibility: hidden;
    }
    
    /* Show only print content */
    .print-content, .print-content * {
        visibility: visible;
    }
    
    .print-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    /* Hide UI elements */
    .navbar, .nav-btn, .print-history-btn, .clear-history-btn, 
    .mood-section, .input-section, .status, .no-print,
    .mobile-menu-toggle, .history-controls {
        display: none !important;
    }
    
    /* Print header styles */
    .print-header {
        text-align: center;
        border-bottom: 3px solid #4facfe;
        padding-bottom: 20px;
        margin-bottom: 30px;
    }
    
    .print-logo {
        font-size: 48px;
        margin-bottom: 10px;
    }
    
    .print-title {
        color: #4facfe;
        font-size: 28px;
        font-weight: bold;
        margin: 0;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
    
    .print-subtitle {
        color: #666;
        font-size: 14px;
        margin: 5px 0 0 0;
    }
    
    .print-info {
        background: #f8f9fa;
        padding: 15px;
        border-radius: 8px;
        margin: 20px 0;
        border-left: 4px solid #4facfe;
        font-size: 14px;
        line-height: 1.6;
    }
    
    .print-conversation-item {
        margin-bottom: 25px;
        page-break-inside: avoid;
        border: 1px solid #eee;
        border-radius: 8px;
        padding: 15px;
        background: #fdfdfd;
    }
    
    .print-conversation-date {
        color: #4facfe;
        font-weight: bold;
        font-size: 12px;
        margin-bottom: 8px;
    }
    
    .print-conversation-mood {
        background: #1e3a8a !important;
        color: white !important;
        padding: 5px 12px;
        border-radius: 12px;
        font-size: 12px;
        font-weight: 800;
        display: inline-block;
        margin-bottom: 10px;
        border: 2px solid #1e3a8a;
    }
    
    .print-user-message {
        background: #1e3a8a !important;
        color: white !important;
        padding: 15px 18px;
        border-radius: 15px 15px 5px 15px;
        margin-bottom: 12px;
        font-size: 16px;
        font-weight: 700;
        max-width: 85%;
        margin-left: auto;
        text-align: left;
        line-height: 1.4;
        border: 2px solid #1e3a8a;
    }
    
    .print-user-message strong {
        font-weight: 900 !important;
        color: white !important;
    }
    
    .print-ai-message {
        background: #f8f9fa;
        border: 1px solid #ddd;
        padding: 12px 15px;
        border-radius: 15px 15px 15px 5px;
        font-size: 14px;
        max-width: 85%;
        line-height: 1.4;
    }
    
    .print-footer {
        margin-top: 30px;
        padding-top: 20px;
        border-top: 1px solid #ddd;
        text-align: center;
        font-size: 10px;
        color: #666;
        line-height: 1.4;
    }
    
    @page {
        margin: 0.75in;
        size: letter;
    }
}

/* Enhanced Accessibility */
*:focus {
    outline: 2px solid #4facfe;
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .container {
        border: 2px solid #000;
    }
    
    .print-history-btn, .clear-history-btn {
        border: 3px solid #000;
    }
}

/* Enhanced Mobile Experience */
@media (max-width: 768px) {
    .main-content {
        padding: 10px;
    }
    
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .header {
        padding: 30px 20px;
    }
    
    .header h1 {
        font-size: 2.2em;
    }
    
    .history-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .history-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .print-history-btn, .clear-history-btn {
        flex: 1;
        min-width: 140px;
        justify-content: center;
    }
    
    #historyContainer {
        max-height: 350px;
        padding: 15px;
    }
    
    .conversation {
        padding: 15px;
    }
    
    .user-msg, .ai-msg {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8em;
    }
    
    .history-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .print-history-btn, .clear-history-btn {
        width: 100%;
    }
    
    .conversation {
        padding: 12px;
    }
}
/* ============================================================================ */
/* 🆕 NEW: DELETION WARNING STYLES */
/* ============================================================================ */

.deletion-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 2px solid #f39c12;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.2);
    animation: slideDown 0.4s ease-out;
    position: relative;
    overflow: hidden;
}

.deletion-warning::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    animation: warningShimmer 3s ease-in-out infinite;
}

@keyframes warningShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.warning-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.warning-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.warning-text {
    flex: 1;
    color: #856404;
    font-size: 15px;
    line-height: 1.5;
}

.warning-text strong {
    color: #5a4301;
    font-weight: 700;
}

.warning-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.warning-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.warning-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transition: left 0.5s ease;
}

.warning-btn:hover::before {
    left: 100%;
}

.warning-btn-primary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.warning-btn-primary:hover {
    background: linear-gradient(135deg, #3a9bfd 0%, #00d9fd 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.warning-btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

.warning-btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}
/* Add this keyframe animation to main.css */
@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
    }
}

@keyframes slideUp {
    0% {
        opacity: 1;
        transform: translateY(0);
        max-height: 200px;
    }
    100% {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }
}
     /* ============================================================================ */
/* 🆕 NEW: USER PROFILE MODAL STYLES */
/* ============================================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease-out;
    position: relative;
}

@keyframes slideInUp {
    from { 
        opacity: 0; 
        transform: translateY(30px) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.modal-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 25px 30px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 700;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-body {
    padding: 30px;
}

.profile-loading {
    text-align: center;
    padding: 40px;
    color: #4facfe;
    font-size: 16px;
}

.profile-loading::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(79, 172, 254, 0.2);
    border-top-color: #4facfe;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
    vertical-align: middle;
}

.profile-content {
    animation: fadeInContent 0.4s ease-out;
}

@keyframes fadeInContent {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.account-info-grid {
    display: grid;
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.05) 0%, rgba(0, 242, 254, 0.05) 100%);
    border-radius: 10px;
    border: 1px solid rgba(79, 172, 254, 0.1);
}

.info-item label {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.info-item span {
    color: #2c3e50;
    font-weight: 500;
    text-align: right;
}

#deletionWarningItem {
    border-color: rgba(243, 156, 18, 0.3);
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.05) 0%, rgba(255, 193, 7, 0.05) 100%);
}

#deletionWarningItem label {
    color: #856404;
}

#deletionWarningItem span {
    color: #f39c12;
    font-weight: 600;
}

/* Form styling within modal - reuse settings styles */
.modal-body .settings-group {
    margin-bottom: 25px;
}

.modal-body .settings-save-btn {
    margin-top: 15px;
}

/* Mobile responsive for modal */
@media (max-width: 768px) {
    .modal-overlay {
        padding: 10px;
    }
    
    .modal-content {
        border-radius: 15px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 20px;
        border-radius: 15px 15px 0 0;
    }
    
    .modal-header h3 {
        font-size: 1.2em;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .info-item span {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 15px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .account-info-grid {
        gap: 10px;
    }
    
    .info-item {
        padding: 10px 12px;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .deletion-warning {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .warning-content {
        gap: 12px;
        margin-bottom: 15px;
    }
    
    .warning-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .warning-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .deletion-warning {
        padding: 12px;
    }
    
    .warning-text {
        font-size: 14px;
    }
    
    .warning-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* ============================================================================ */
/* 🆕 NEW: LEGAL FOOTER AND MODAL STYLES */
/* ============================================================================ */

/* Legal Footer */
.legal-footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 25px 20px;
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.footer-content {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #ecf0f1;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.footer-links a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.footer-text {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-text p {
    color: #bdc3c7;
    font-size: 13px;
    margin: 0;
    opacity: 0.8;
}

/* Legal Modal */
.legal-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease-out;
}

.legal-modal-content {
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    animation: slideInUp 0.3s ease-out;
    position: relative;
}

.legal-modal-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.legal-modal-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 700;
}

.legal-modal-close {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.legal-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.legal-modal-body {
    padding: 30px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
    line-height: 1.6;
    color: #2c3e50;
}

.legal-modal-body h1,
.legal-modal-body h2,
.legal-modal-body h3 {
    color: #4facfe;
    margin-top: 30px;
    margin-bottom: 15px;
}

.legal-modal-body h1 {
    font-size: 1.8em;
    margin-top: 0;
}

.legal-modal-body h2 {
    font-size: 1.4em;
}

.legal-modal-body h3 {
    font-size: 1.2em;
}

.legal-modal-body p {
    margin-bottom: 15px;
}

.legal-modal-body ul {
    margin-bottom: 15px;
    padding-left: 25px;
}

.legal-modal-body li {
    margin-bottom: 8px;
}

.legal-modal-body strong {
    color: #2c3e50;
    font-weight: 700;
}

.legal-modal-body::-webkit-scrollbar {
    width: 8px;
}

.legal-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.legal-modal-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border-radius: 4px;
}

.legal-modal-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #3a9bfd 0%, #00d9fd 100%);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .footer-links {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
    
    .footer-links a {
        width: 200px;
        text-align: center;
    }
    
    .legal-modal-content {
        border-radius: 15px;
        margin: 10px;
        max-height: 95vh;
    }
    
    .legal-modal-header {
        padding: 20px;
    }
    
    .legal-modal-body {
        padding: 20px;
        max-height: calc(95vh - 80px);
    }
}

@media (max-width: 480px) {
    .legal-footer {
        padding: 20px 15px;
    }
    
    .footer-links a {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .footer-text p {
        font-size: 12px;
    }
    
    .legal-modal-header {
        padding: 15px;
    }
    
    .legal-modal-body {
        padding: 15px;
    }
}
/* =====================================
   ENHANCED ERROR HANDLING STYLES
   ===================================== */

.gentle-retry-suggestion {
  animation: fadeInGentle 0.5s ease-in;
}

.fallback-options {
  animation: slideInUp 0.4s ease-out;
}

.fallback-btn {
  background: white;
  border: 2px solid #4facfe;
  color: #4facfe;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

.fallback-btn:hover {
  background: #4facfe;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.retry-btn:hover {
  background: #369efd;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(79, 172, 254, 0.4);
}

@keyframes fadeInGentle {
  from { 
    opacity: 0; 
    transform: translateY(10px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

@keyframes slideInUp {
  from { 
    opacity: 0; 
    transform: translateY(20px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}

/* Enhanced error UI for mobile */
@media (max-width: 768px) {
  .fallback-btn {
    padding: 14px 18px;
    font-size: 16px;
  }
  
  .gentle-retry-suggestion div {
    padding: 20px 15px !important;
  }
  
  .retry-btn {
    padding: 12px 20px !important;
    font-size: 16px !important;
  }
}
/* ============================================================================ */
/* 💝 HOURS OF LOVE TIME TRACKING MODAL - MATCHES YOUR DESIGN THEME */
/* ============================================================================ */

 .love-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 10px;
    box-sizing: border-box;
    overflow-y: auto;
}

@keyframes loveModalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

 .love-modal-content {
    background: linear-gradient(135deg, #fff5f5 0%, #fef7f7 100%);
    border-radius: 25px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    height: auto;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(255, 107, 107, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    margin: auto;
    animation: loveModalFadeIn 0.3s ease-out;
}

@keyframes loveModalSlideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px) scale(0.95); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

/* Modal Header with Celebration */
.love-modal-header {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    padding: 30px 25px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.love-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: loveHeaderShimmer 4s infinite;
}

@keyframes loveHeaderShimmer {
    0% { transform: translateX(-100%) translateY(-100%); }
    100% { transform: translateX(100%) translateY(100%); }
}

.love-celebration {
    position: relative;
    z-index: 1;
}

.love-icon {
    font-size: 3em;
    margin-bottom: 15px;
    animation: loveIconBounce 1s ease-in-out infinite alternate;
}

@keyframes loveIconBounce {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

.love-modal-header h2 {
    font-size: 1.6em;
    font-weight: 700;
    margin: 0 0 8px 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.love-modal-header p {
    font-size: 1.1em;
    opacity: 0.9;
    margin: 0;
    font-weight: 300;
}

/* Modal Body */
.love-modal-body {
    padding: 30px 25px;
    overflow-y: auto;
    max-height: calc(90vh - 200px);
}

/* Task Info */
.love-task-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    border: 2px solid rgba(79, 172, 254, 0.1);
    text-align: center;
}

.completed-task-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

/* Time Selection */
.love-time-selection h3 {
    color: #2c3e50;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.love-time-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 25px;
}

.love-time-btn {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid rgba(79, 172, 254, 0.2);
    border-radius: 15px;
    padding: 18px 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.love-time-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(79, 172, 254, 0.1), 
        transparent);
    transition: left 0.5s ease;
}

.love-time-btn:hover {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border-color: rgba(79, 172, 254, 0.4);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.3);
}

.love-time-btn:hover::before {
    left: 100%;
}

.love-time-btn.selected {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-color: rgba(40, 167, 69, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.time-display {
    display: block;
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 4px;
}

.time-label {
    display: block;
    font-size: 0.85em;
    opacity: 0.8;
    font-weight: 500;
}

/* Custom Time Input */
.custom-time-section {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid rgba(79, 172, 254, 0.2);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    animation: slideDown 0.3s ease-out;
}

.custom-time-inputs {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
}

#customTimeValue {
    width: 80px;
    padding: 12px 16px;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
}

#customTimeValue:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

#customTimeUnit {
    padding: 12px 16px;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    cursor: pointer;
}

#customTimeUnit:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

/* Notes Section */
.love-notes-section {
    margin-top: 25px;
}

.love-notes-section label {
    display: block;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.95em;
}

#loveNotes {
    width: 100%;
    padding: 15px 18px;
    border: 2px solid #e0e6ed;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    min-height: 80px;
}

#loveNotes:focus {
    outline: none;
    border-color: #4facfe;
    box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.1);
}

#loveNotes::placeholder {
    color: #adb5bd;
    font-style: italic;
}

/* Modal Footer */
.love-modal-footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 25px;
    border-top: 1px solid rgba(79, 172, 254, 0.1);
}

.love-encouragement {
    text-align: center;
    margin-bottom: 20px;
}

.love-encouragement p {
    color: #6c757d;
    font-size: 0.95em;
    font-weight: 600;
    margin: 0;
    font-style: italic;
}

.love-modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.love-skip-btn, .love-save-btn {
    padding: 14px 25px;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

.love-skip-btn::before,
.love-save-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transition: left 0.5s ease;
}

.love-skip-btn {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.2);
}

.love-skip-btn:hover {
    background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3);
}

.love-skip-btn:hover::before {
    left: 100%;
}

.love-save-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
}

.love-save-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #20c997 0%, #17a2b8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.love-save-btn:hover:not(:disabled)::before {
    left: 100%;
}

.love-save-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.1);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .love-modal-overlay {
        padding: 15px;
    }
    
    .love-modal-content {
        max-width: 100%;
        border-radius: 20px;
    }
    
    .love-modal-header {
        padding: 25px 20px;
    }
    
    .love-modal-body {
        padding: 25px 20px;
    }
    
    .love-time-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .love-time-btn {
        padding: 15px 10px;
    }
    
    .time-display {
        font-size: 1em;
    }
    
    .time-label {
        font-size: 0.8em;
    }
    
    .love-modal-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .love-skip-btn, .love-save-btn {
        width: 100%;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .love-modal-overlay {
        padding: 10px;
    }
    
    .love-modal-header {
        padding: 20px 15px;
    }
    
    .love-modal-body {
        padding: 20px 15px;
    }
    
    .love-modal-footer {
        padding: 20px 15px;
    }
    
    .love-time-buttons {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Accessibility */
.love-time-btn:focus,
.love-skip-btn:focus,
.love-save-btn:focus,
#customTimeValue:focus,
#customTimeUnit:focus,
#loveNotes:focus {
    outline: 3px solid rgba(79, 172, 254, 0.6);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .love-modal-content,
    .love-task-info,
    .custom-time-section,
    .love-modal-footer {
        border: 3px solid #000;
        background: #fff;
    }
    
    .love-time-btn,
    .love-skip-btn,
    .love-save-btn {
        border: 3px solid #000;
    }
}

 