/* Quinly 2.0 - Complete CSS Styles */

/* CSS Custom Properties for Theming - Quinly 2.0 */
:root {
    --primary-color: #07A3B2;
    --accent-color: #9B59B6;
    --secondary-color: #E8F4E9;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --font-scale: 1;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
}

/* Base Styles */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #ffffff;
    margin: 0 !important;
    padding: 0 !important;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
    touch-action: manipulation;
    border: none !important;
    outline: none !important;
    font-size: calc(14px * var(--font-scale));
    line-height: 1.5;
    /* Better text rendering on mobile */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Prevent horizontal scroll */
    max-width: 100vw;
}

* {
    box-sizing: border-box;
}

/* Container Overrides */
.container, .container-fluid {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    height: 100vh;
}

/* Chat Container */
.chat-container {
    background-color: #fff;
    border-radius: 0;
    box-shadow: none;
    border: none !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
}

/* Header Styles */
.chat-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
    position: relative;
    border-bottom: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.chat-header h1 {
    margin: 0;
    font-size: calc(2rem * var(--font-scale));
    font-weight: 700;
    letter-spacing: -0.025em;
}

.privacy-notice {
    font-size: calc(1rem * var(--font-scale));
    margin: 8px 0 0;
    opacity: 0.9;
    line-height: 1.4;
    font-weight: 400;
    text-align: center;
}

.privacy-badge {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: calc(0.75rem * var(--font-scale));
    font-weight: 600;
    margin-left: 4px;
}

/* Brand Content */
.brand-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.school-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

/* Close Widget Button */
.close-widget {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
    transition: var(--transition);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-widget:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
    transform: scale(1.05);
}

/* Accessibility Controls */
.accessibility-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.accessibility-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(243, 156, 18, 0.3);
    border-radius: 50%;
    color: #07A3B2;
    cursor: pointer;
    font-size: calc(12px * var(--font-scale));
    padding: 8px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    backdrop-filter: blur(10px);
}

.accessibility-btn:hover, 
.accessibility-btn:focus {
    background: #9B59B6;
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(155, 89, 182, 0.3);
    border-color: #9B59B6;
}

.accessibility-btn.active {
    background: #9B59B6;
    color: #ffffff;
    border-color: #9B59B6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.25);
}

/* Language Panel */
.language-panel {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.language-options {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.language-option {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    color: #495057;
    cursor: pointer;
    font-size: calc(0.8rem * var(--font-scale));
    padding: 6px 12px;
    transition: var(--transition);
    font-weight: 500;
}

.language-option:hover,
.language-option.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fafafa;
    min-height: 0;
    scroll-behavior: smooth;
}

/* Message Styles */
.message {
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    animation: messageSlide 0.3s ease-out;
}

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

.user-message {
    justify-content: flex-end;
}

.user-message .message-content {
    background: #07A3B2;
    color: white;
    padding: 12px 16px;
    border-radius: 18px 18px 4px 18px;
    max-width: 75%;
    word-wrap: break-word;
    margin-left: auto;
    margin-right: 15px;
    box-shadow: 0 2px 8px rgba(7, 163, 178, 0.3);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.quinly-message {
    justify-content: flex-start;
}

.quinly-message .message-content {
    background: #ffffff;
    color: #333333;
    padding: 12px 16px;
    border-radius: 18px 18px 18px 4px;
    max-width: 75%;
    word-wrap: break-word;
    margin: 0 15px 0 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    position: relative;
}

.quinly-message .message-content::before {
    content: '';
    position: absolute;
    left: -8px;
    bottom: 8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid white;
    border-bottom: 8px solid white;
    filter: drop-shadow(-1px 1px 1px rgba(0,0,0,0.05));
    z-index: -1;
}

/* Message Avatar */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    background: rgba(255,255,255,0.9);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    font-size: 14px;
    flex-shrink: 0;
}

/* Message Text */
.message-text {
    margin: 0;
    line-height: 1.5;
    font-size: calc(16px * var(--font-scale));
}

/* Typing Indicator */
.typing-indicator {
    opacity: 0.8;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

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

/* Input Container */
.chat-input-container {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 15px;
}

.input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 8px;
}

#message-input {
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 12px 16px;
    font-size: calc(16px * var(--font-scale));
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: var(--transition);
    flex: 1;
    outline: none;
    font-family: inherit;
}

#message-input:focus {
    border-color: #07A3B2;
    box-shadow: 0 0 0 3px rgba(30, 156, 184, 0.1);
}

#message-input::placeholder {
    color: #999;
    opacity: 1;
}

/* Voice Input Button */
#voice-input-btn {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    transition: var(--transition);
    flex-shrink: 0;
}

#voice-input-btn:hover,
#voice-input-btn.active {
    background: #9B59B6;
    color: white;
    border-color: #9B59B6;
    transform: scale(1.05);
}

/* Send Button */
#send-button {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: white;
    transition: var(--transition);
    flex-shrink: 0;
}

#send-button:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(30, 156, 184, 0.3);
    opacity: 0.9;
}

/* Voice Status */
.voice-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--danger-color);
    font-size: calc(0.85rem * var(--font-scale));
    margin-top: 8px;
    font-weight: 500;
}

.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Footer Controls */
.quinly-footer {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 10px 15px;
}

.footer-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.footer-btn {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: calc(16px * var(--font-scale));
    padding: 8px;
    transition: var(--transition);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.footer-btn:hover,
.footer-btn.active {
    color: #07A3B2;
    background: rgba(30, 156, 184, 0.1);
    transform: scale(1.1);
}

.footer-btn .notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: bounce 0.5s ease-in-out;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Resources Container */
.resources-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
    /* Mobile-specific optimizations */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    overflow: hidden;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.resources-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resources-header h5 {
    margin: 0;
    font-weight: 600;
}

#close-resources-btn {
    background: rgba(255,255,255,0.9) !important;
    border: 2px solid white !important;
    color: var(--primary-color) !important;
    font-size: 20px !important;
    font-weight: bold !important;
    cursor: pointer !important;
    padding: 8px !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
    z-index: 999 !important;
    transition: all 0.3s ease !important;
}

#close-resources-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    opacity: 1;
    transform: scale(1.05);
}

.resources-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.resource-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.resource-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.resource-item h6 {
    color: #07A3B2;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: calc(1rem * var(--font-scale));
}

.resource-item p {
    margin-bottom: 6px;
    font-size: calc(0.9rem * var(--font-scale));
    line-height: 1.4;
}

.resource-item a {
    color: #07A3B2;
    text-decoration: none;
    transition: var(--transition);
}

.resource-item a:hover {
    text-decoration: underline;
    color: #0097B2;
}

/* Accessibility Modes */

/* High Contrast Mode */
.high-contrast {
    background: #000000 !important;
    color: #ffffff !important;
}

.high-contrast .chat-container {
    background: #000000 !important;
    border: 2px solid #ffffff !important;
}

.high-contrast .chat-header {
    background: #000000 !important;
    color: #ffffff !important;
    border-bottom: 2px solid #ffffff !important;
}

.high-contrast .chat-messages {
    background: #000000 !important;
    color: #ffffff !important;
}

.high-contrast .user-message .message-content {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
}

.high-contrast .quinly-message .message-content {
    background: #333333 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

.high-contrast .chat-input-container {
    background: #000000 !important;
    border-top: 2px solid #ffffff !important;
}

.high-contrast #message-input {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}

.high-contrast #send-button,
.high-contrast #voice-input-btn {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
}

.high-contrast .quinly-footer {
    background: #000000 !important;
    border-top: 2px solid #ffffff !important;
}

.high-contrast .footer-btn {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
}

/* Ensure all specific footer buttons are consistent in hi-vis mode */
.high-contrast .footer-btn#resources-button,
.high-contrast .footer-btn#reset-button,
.high-contrast .footer-btn#tts-toggle {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
}

.high-contrast .accessibility-btn {
    background: #ffffff !important;
    color: #000000 !important;
    border: 2px solid #ffffff !important;
}

/* Dyslexia Friendly Mode */
.dyslexia-friendly {
    font-family: 'OpenDyslexic', 'Comic Sans MS', cursive !important;
    background: #fffef7 !important;
    line-height: 1.6 !important;
    letter-spacing: 0.5px !important;
}

.dyslexia-friendly * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', cursive !important;
    line-height: 1.6 !important;
    letter-spacing: 0.5px !important;
}

.dyslexia-friendly .chat-container {
    background: #fffef7 !important;
}

.dyslexia-friendly .chat-header {
    background: linear-gradient(135deg, #2c5f6f, #4a8fa6) !important;
    color: #ffffff !important;
}

.dyslexia-friendly .chat-messages {
    background: #fffef7 !important;
    color: #2c2c2c !important;
    font-size: calc(16px * var(--font-scale)) !important;
}

.dyslexia-friendly .message-text {
    font-size: calc(16px * var(--font-scale)) !important;
    line-height: 1.8 !important;
    letter-spacing: 1px !important;
}

.dyslexia-friendly .user-message .message-content {
    background: linear-gradient(135deg, #4a90a4, #5ca3b8) !important;
    color: #ffffff !important;
    font-size: calc(16px * var(--font-scale)) !important;
}

.dyslexia-friendly .quinly-message .message-content {
    background: #f0f0e8 !important;
    color: #2c2c2c !important;
    border: 1px solid #d0d0c8 !important;
    font-size: calc(16px * var(--font-scale)) !important;
}

.dyslexia-friendly #message-input {
    font-size: calc(16px * var(--font-scale)) !important;
    line-height: 1.6 !important;
    letter-spacing: 0.5px !important;
    background: #fffef7 !important;
    color: #2c2c2c !important;
}

/* Preserve FontAwesome icons in dyslexia mode */
.dyslexia-friendly .fas,
.dyslexia-friendly .far,
.dyslexia-friendly .fab,
.dyslexia-friendly .fa,
.dyslexia-friendly i[class*="fa-"] {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    font-weight: 900 !important;
    letter-spacing: normal !important;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    /* Safe area support for modern phones */
    html, body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }
    
    .chat-header {
        padding: 12px 15px;
    }
    
    .chat-header h1 {
        font-size: calc(1.5rem * var(--font-scale));
        margin-bottom: 4px;
    }
    
    .privacy-notice {
        font-size: calc(0.85rem * var(--font-scale));
        line-height: 1.3;
        margin: 6px 0 0;
    }
    
    .accessibility-controls {
        gap: 6px;
        margin-top: 6px;
    }
    
    .accessibility-btn {
        width: 36px;
        height: 36px;
        font-size: calc(12px * var(--font-scale));
        /* Better touch targets */
        min-height: 44px;
        min-width: 44px;
    }
    
    .chat-messages {
        padding: 12px;
        max-height: calc(100vh - 200px);
        max-height: calc(100dvh - 200px);
    }
    
    .chat-input-container {
        padding: 12px;
        /* Ensure input stays above mobile keyboard */
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .quinly-footer {
        padding: 8px 15px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }
    
    .footer-branding {
        font-size: calc(0.75rem * var(--font-scale));
        text-align: center;
        margin-top: 6px;
    }
    
    .footer-controls {
        gap: 12px;
        justify-content: space-around;
        flex-wrap: wrap;
    }
    
    .footer-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
    
    .message {
        margin-bottom: 12px;
    }
    
    .user-message .message-content,
    .quinly-message .message-content {
        max-width: 90%;
        font-size: calc(15px * var(--font-scale));
        padding: 10px 14px;
        line-height: 1.4;
    }
    
    .language-panel {
        padding: 12px;
    }
    
    .language-options {
        gap: 6px;
        justify-content: center;
    }
    
    .language-option {
        font-size: calc(0.8rem * var(--font-scale));
        padding: 8px 12px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improved input area for mobile */
    #message-input {
        font-size: 16px; /* Prevent iOS zoom */
        min-height: 44px;
        border-radius: 22px;
        padding: 12px 16px;
    }
    
    #voice-input-btn,
    #send-button {
        min-width: 44px;
        min-height: 44px;
        width: 44px;
        height: 44px;
    }
}

@media (max-width: 480px) {
    .chat-header {
        padding: 10px 12px;
    }
    
    .chat-header h1 {
        font-size: calc(1.4rem * var(--font-scale));
        margin-bottom: 2px;
    }
    
    .privacy-notice {
        font-size: calc(0.8rem * var(--font-scale));
        margin: 4px 0 0;
        line-height: 1.2;
    }
    
    .privacy-badge {
        font-size: calc(0.7rem * var(--font-scale));
        padding: 2px 6px;
        margin-left: 2px;
        display: inline-block;
        margin-top: 2px;
    }
    
    .accessibility-controls {
        gap: 4px;
        margin-top: 4px;
    }
    
    .accessibility-btn {
        width: 32px;
        height: 32px;
        font-size: calc(11px * var(--font-scale));
        min-width: 44px;
        min-height: 44px;
    }
    
    .chat-messages {
        padding: 10px;
        max-height: calc(100vh - 180px);
        max-height: calc(100dvh - 180px);
    }
    
    .chat-input-container {
        padding: 8px 10px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }
    
    .quinly-footer {
        padding: 6px 10px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
        font-size: calc(0.75rem * var(--font-scale));
    }
    
    .footer-branding {
        margin-top: 4px;
        font-size: calc(0.7rem * var(--font-scale));
    }
    
    .footer-controls {
        gap: 8px;
        justify-content: space-around;
    }
    
    .footer-btn {
        min-width: 40px;
        min-height: 40px;
        width: 40px;
        height: 40px;
    }
    
    #message-input {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 40px;
        border-radius: 20px;
        padding: 10px 14px;
    }
    
    #voice-input-btn,
    #send-button {
        min-width: 40px;
        min-height: 40px;
        width: 40px;
        height: 40px;
    }
    
    .language-options {
        gap: 4px;
        flex-wrap: wrap;
    }
    
    .language-option {
        font-size: calc(0.75rem * var(--font-scale));
        padding: 6px 10px;
        min-height: 40px;
        flex: 1 1 auto;
        min-width: 90px;
    }
    
    .user-message .message-content,
    .quinly-message .message-content {
        max-width: 95%;
        font-size: calc(14px * var(--font-scale));
        padding: 8px 12px;
    }
    
    .message {
        margin-bottom: 10px;
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .chat-header {
        padding: 6px 15px;
    }
    
    .chat-header h1 {
        font-size: calc(1.2rem * var(--font-scale));
        margin-bottom: 2px;
    }
    
    .privacy-notice {
        font-size: calc(0.75rem * var(--font-scale));
        margin: 2px 0 0;
    }
    
    .accessibility-controls {
        margin-top: 2px;
        gap: 4px;
    }
    
    .accessibility-btn {
        width: 28px;
        height: 28px;
        min-width: 36px;
        min-height: 36px;
    }
    
    .chat-messages {
        max-height: calc(100vh - 120px);
        max-height: calc(100dvh - 120px);
        padding: 8px;
    }
    
    .chat-input-container {
        padding: 6px 10px;
    }
    
    .quinly-footer {
        padding: 4px 15px;
    }
    
    .footer-branding {
        font-size: calc(0.65rem * var(--font-scale));
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .typing-dots span {
        animation: none;
    }
    
    .pulse {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .chat-header,
    .chat-input-container,
    .quinly-footer,
    .accessibility-controls,
    .close-widget {
        display: none !important;
    }
    
    .chat-messages {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }
    
    .message {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* Screen Reader Only Content */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus Styles for Accessibility */
button:focus,
textarea:focus,
.accessibility-btn:focus,
.footer-btn:focus {
    outline: 3px solid rgba(30, 156, 184, 0.5);
    outline-offset: 2px;
}

/* Footer Branding */
.footer-branding {
    text-align: center;
    padding: 12px 20px;
    font-size: calc(0.8rem * var(--font-scale));
    color: #666;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.footer-branding a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.footer-branding a:hover {
    text-decoration: underline;
}

.footer-icon {
    margin-right: 6px;
    color: var(--accent-color);
    opacity: 0.8;
}

/* Footer Controls Styling - Clean like original */
.footer-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 15px;
    background: white;
    border-top: 1px solid #e9ecef;
}

/* Resources notification badge */
.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.footer-btn {
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 400;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-width: 100px;
    height: 44px;
}

.footer-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Default hover for info button */
.footer-btn#resources-button:hover {
    background: rgba(74, 159, 199, 0.05);
}

/* Volume button keeps circular design with lilac color */
.footer-btn#tts-toggle {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
    padding: 0;
    font-size: 16px;
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.footer-btn#tts-toggle:hover {
    background: rgba(156, 136, 204, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

/* Refresh button with Quinly green border only - pill shaped */
.footer-btn#reset-button {
    border-color: #8bc34a !important;
    color: #8bc34a !important;
    background-color: transparent !important;
    border-radius: 25px !important;
    font-weight: 500;
    border-width: 2px;
}

.footer-btn#reset-button:hover {
    background-color: rgba(139, 195, 74, 0.1) !important;
    border-color: #7cb342 !important;
    color: #7cb342 !important;
    transform: scale(1.02);
}

/* Accessibility Toggle */
.accessibility-toggle {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.accessibility-toggle-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: #666;
    font-size: 14px;
}

.accessibility-toggle-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

/* Additional Utility Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* Privacy Modal */
.privacy-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.privacy-modal.d-none {
    display: none !important;
}

.privacy-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    width: 100%;
}

.privacy-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.privacy-header h5 {
    margin: 0;
    font-weight: 600;
}

.privacy-header .btn-close {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    font-size: 18px;
    padding: 8px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.privacy-header .btn-close:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.privacy-body {
    padding: 25px;
    color: #333;
    line-height: 1.6;
}

.privacy-body h6 {
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-body h6:first-child {
    margin-top: 0;
}

.disclaimer-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.disclaimer-section ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.disclaimer-section li {
    margin-bottom: 5px;
}

.privacy-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    text-align: center;
}

.privacy-badge {
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 2px 6px;
    border-radius: 4px;
}

.privacy-badge:hover,
.privacy-badge:focus {
    background: rgba(255,255,255,0.1);
    outline: none;
}
/* Mobile-specific touch improvements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .footer-btn:hover,
    .accessibility-btn:hover,
    .language-option:hover {
        transform: none;
    }
    
    /* Enhanced touch feedback */
    .footer-btn:active,
    .accessibility-btn:active,
    .language-option:active,
    #send-button:active,
    #voice-input-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Better tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(7, 163, 178, 0.2);
    }
}

/* iOS specific optimizations */
@supports (-webkit-touch-callout: none) {
    .chat-container {
        /* Prevent rubber band scrolling */
        overscroll-behavior: contain;
    }
    
    .chat-messages {
        /* iOS momentum scrolling */
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Prevent iOS zoom on input focus */
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* Android specific optimizations */
@media screen and (-webkit-device-pixel-ratio: 2) and (max-width: 767px) {
    /* Crisp rendering on high-DPI Android devices */
    .accessibility-btn,
    .footer-btn,
    #send-button,
    #voice-input-btn {
        transform: translateZ(0);
        will-change: transform;
    }
}

/* Additional mobile resources panel optimization */
@media (max-width: 768px) {
    .resources-list {
        padding: 15px;
    }
    
    .resource-item {
        margin-bottom: 12px;
        padding: 12px;
    }
    
    .resource-item h6 {
        font-size: calc(0.9rem * var(--font-scale));
    }
    
    .resource-item p {
        font-size: calc(0.85rem * var(--font-scale));
    }
}

/* Dashboard Header Fix - Force Correct Colors */
.dashboard-header {
    background: #6B9B73 !important;
    background-color: #6B9B73 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dashboard-title,
.dashboard-subtitle-title,
.dashboard-subtitle,
.subscription-badge {
    color: white !important;
}

.dashboard-subtitle-title {
    color: #E8F4E9 !important;
}

/* Clean Card Styling */
.card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.card-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 12px 16px;
}

.card-header h5 {
    font-size: 0.95rem !important;
    font-weight: 600;
    color: #495057;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chart-container {
    height: 280px;
    position: relative;
    overflow: hidden;
    padding: 10px;
}

/* Clean Metrics Cards */
.metric-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 700;
    color: #6B9B73;
    margin-bottom: 5px;
}

.metric-label {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Clean up alert styling - much more readable */
.alert {
    font-size: 0.95rem;
    padding: 15px 18px;
    margin-bottom: 12px;
    border: none;
    background-color: #f8f9fa;
    color: #6c757d;
    border-left: 4px solid #6B9B73;
    line-height: 1.5;
    word-wrap: break-word;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

/* Hide crisis alerts by default for clean design */
#crisis-alerts {
    display: none !important;
}