/* Main CSS for ACME Energy Presales Application */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Language Selector Styles */
.language-selector {
    position: relative;
    display: inline-block;
}

.current-language {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    min-width: 120px;
}

.current-language:hover {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.flag-icon {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
}

.arrow-down {
    margin-left: auto;
    transition: transform 0.2s ease;
}

.language-selector.open .arrow-down {
    transform: rotate(180deg);
}

.language-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1002;
    display: none;
    margin-top: 5px;
}

.language-selector.open .language-dropdown {
    display: block;
}

.language-option {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s ease;
    font-size: 14px;
}

.language-option:hover {
    background: #f5f5f5;
}

.language-option.selected {
    background: #e3f2fd;
    color: #1976d2;
}

/* Language prompt styles */
.language-switch-prompt {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.language-prompt-buttons {
    display: flex;
    gap: 10px;
}

.language-prompt-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.language-prompt-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Browser Language Detection Prompt */
.language-prompt {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1001;
    animation: slideInRight 0.3s ease-out;
}

.language-prompt-content {
    background: linear-gradient(135deg, #4caf50, #45a049);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    max-width: 280px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Voice Input Styles */
.voice-input-container {
    position: relative;
    display: inline-block;
}

/* Hide voice features in Firefox */
@-moz-document url-prefix() {
    .voice-input-container {
        display: none !important;
    }
}

.voice-btn {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.voice-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.voice-btn:active {
    transform: scale(0.95);
}

.voice-btn.recording {
    background: linear-gradient(45deg, #ff4757, #ff3838);
    animation: pulse 1.5s infinite;
}

.voice-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* File upload button styles */
.file-upload-btn, .camera-btn {
    background: linear-gradient(45deg, #4834d4, #6c5ce7);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
    transition: all 0.3s ease;
}

.file-upload-btn:hover, .camera-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.file-upload-btn:active, .camera-btn:active {
    transform: scale(0.95);
}

.file-upload-btn.uploading {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    animation: pulse 1.5s infinite;
}

.file-upload-container {
    display: flex;
    align-items: center;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 71, 87, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 71, 87, 0); }
}

.recording-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px 30px;
    border-radius: 15px;
    z-index: 1003;
    display: none;
    align-items: center;
    gap: 15px;
    font-size: 16px;
    backdrop-filter: blur(10px);
}

.pulse-animation {
    width: 20px;
    height: 20px;
    background: #ff4757;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.input-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-enhanced {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    width: 100%;
}

.chat-input-enhanced:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.voice-not-supported {
    background: #666;
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 11px;
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    display: none;
}

.logo {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
    text-decoration: none;
}

main {
    margin-top: 80px;
    padding: 4rem 0;
}

.hero {
    text-align: center;
    padding: 6rem 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    margin-bottom: 4rem;
    color: white;
}

.hero h1 {
    font-size: 1.6rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero p {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.cta-button {
    display: inline-block;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 15px 40px;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    border: none;
}

.cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(0,0,0,0.3);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin: 4rem 0;
}

.feature-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-card h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 4rem 0;
    text-align: center;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 15px;
    color: white;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    display: block;
    margin-bottom: 0.5rem;
}

/* Chat Widget Styles - Enhanced with 3 States */
.chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: none;
    flex-direction: column;
    z-index: 1001;
    transition: all 0.3s ease-in-out;
    transform-origin: bottom right;
    will-change: transform;
}

/* Chat Widget States */
.chat-widget.expanded {
    width: 80vw;
    height: 80vh;
    bottom: 10vh;
    left: 30%;
    transform: translateX(-50%);
    max-width: 1000px;
    max-height: 700px;
}

/* Responsive message styling for expanded chat */
.chat-widget.expanded .chat-messages {
    padding: 2rem;
}

.chat-widget.expanded .message {
    max-width: 85%;
    margin-bottom: 1.5rem;
}

.chat-widget.expanded .chat-input-container {
    padding: 1.5rem 2rem;
    gap: 15px;
    width: 100%;
    max-width: none;
}

.chat-widget.expanded .input-controls {
    width: 100%;
    gap: 15px;
}

.chat-widget.expanded .chat-input-enhanced {
    flex: 1;
    min-width: 0;
    padding: 15px 20px;
    font-size: 16px;
    min-height: 50px;
}

.chat-widget.expanded .chat-send {
    padding: 15px 25px;
    font-size: 16px;
}

.chat-widget.expanded .voice-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
}

/* Better spacing for larger screens */
@media (min-width: 768px) {
    .chat-widget.expanded .message {
        max-width: 70%;
    }
    
    .chat-widget.expanded .chat-messages {
        padding: 3rem;
    }
    
    .chat-widget.expanded .chat-input-container {
        padding: 2rem 3rem;
        width: 100%;
    }
}

.chat-widget.minimized {
    display: none !important;
}

/* Chat Overlay for Expanded State */
.chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    backdrop-filter: blur(5px);
}

.chat-header {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 1rem;
    border-radius: 15px 15px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
}

.chat-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-control-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    border-bottom: 1px solid #eee;
    width: 100%;
    box-sizing: border-box;
}

.chat-input-container {
    padding: 1rem;
    display: flex;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
}

.chat-send {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
}

.chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1000;
    transition: all 0.3s ease;
}

.chat-toggle:hover {
    transform: scale(1.1);
}

.message {
    margin-bottom: 1rem;
    padding: 10px 15px;
    border-radius: 15px;
    max-width: 80%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

.message.user {
    background: #667eea;
    color: white;
    margin-left: auto;
}

.message.assistant {
    background: #f1f3f4;
    color: #333;
}

.typing-indicator {
    padding: 10px 15px;
    background: #f1f3f4;
    border-radius: 15px;
    max-width: 80%;
    margin-bottom: 1rem;
}

.typing-dots {
    display: inline-block;
}

.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #999;
    margin: 0 2px;
    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; }

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

/* Mobile-First Responsive Design */
@media (max-width: 320px) {
    .hero h1 { font-size: 1.1rem; }
    .hero p { font-size: 1rem; }
    .chat-widget { width: 95vw; right: 2.5vw; height: 400px; }
    .chat-toggle { width: 50px; height: 50px; }
    .features { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    
    /* Hide feature card descriptions on very small screens */
    .feature-card p { display: none; }
    .feature-card { padding: 1rem; }
    
    /* Mobile language selector adjustments */
    .language-selector .current-language {
        min-width: 100px;
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .language-dropdown {
        min-width: 150px;
    }
    
    /* Voice button mobile optimization */
    .voice-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .recording-indicator {
        padding: 15px 20px;
        font-size: 14px;
    }
}

@media (min-width: 321px) and (max-width: 767px) {
    .hero h1 { font-size: 1.2rem; }
    .hero p { font-size: 1.1rem; }
    .chat-widget { width: 90vw; right: 5vw; }
    .features { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .cta-button { padding: 12px 30px; font-size: 1rem; }
    
    /* Hide feature card descriptions on mobile phones */
    .feature-card p { display: none; }
    .feature-card { padding: 1.5rem; }
    
    /* Mobile language and voice optimizations */
    .language-selector .current-language {
        min-width: 110px;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .voice-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .recording-indicator {
        padding: 18px 25px;
        font-size: 15px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .hero h1 { font-size: 1.6rem; }
    .chat-widget { width: 450px; }
    .features { grid-template-columns: repeat(2, 1fr); }
    .stats { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
    .hero h1 { font-size: 1.6rem; }
    .chat-widget { width: 400px; }
    .chat-widget.expanded { width: 70vw; height: 70vh; left: 25%; transform: translateX(-50%); }
}

@media (min-width: 1440px) {
    .container { max-width: 1400px; }
    .hero h1 { font-size: 1.6rem; }
    .chat-widget.expanded { width: 60vw; height: 75vh; left: 20%; transform: translateX(-50%); }
}

/* Touch-friendly buttons on mobile */
@media (max-width: 768px) {
    .cta-button, .chat-send, .chat-control-btn, .chat-toggle {
        min-height: 44px;
        min-width: 44px;
    }
    .chat-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Minimized chat icon styles */
.chat-minimized-icon {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 1002;
    transition: all 0.3s ease;
}

.chat-minimized-icon:hover {
    transform: scale(1.1);
}

.chat-minimized-icon .notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}