/* CSS Custom Properties */
:root {
    --color-snow-white: #ffffff;
    --color-ice-blue: #e3f2fd;
    --color-mountain-dark: #1a1a1a;
    --color-frost: rgba(255, 255, 255, 0.15);
    --color-frost-border: rgba(255, 255, 255, 0.25);
    --color-ai-bubble: rgba(255, 255, 255, 0.5);
    --color-user-bubble: rgba(100, 181, 246, 0.55);
    --blur-amount: 12px;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 8px;
    --spacing-xs: 8px;
    --spacing-sm: 16px;
    --spacing-md: 24px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--color-snow-white);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Background image with blur and overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('assets/IMG_2413.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    filter: blur(3px);
    opacity: 0.7;
    z-index: -1;
}

/* Header Styles */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--color-frost);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-bottom: 1px solid var(--color-frost-border);
    z-index: 100;
    height: 80px;
}

.header-left,
.header-right {
    flex: 1;
}

.header-center {
    flex: 2;
    display: flex;
    justify-content: center;
}

.logo {
    height: 50px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Sponsor Banner */
.sponsor-banner {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    background: var(--color-frost);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-frost-border);
    min-width: 400px;
    width: 100%;
    max-width: 500px;
}

.sponsor-logo-placeholder {
    font-size: 32px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius-sm);
}

.sponsor-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sponsor-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 1;
    font-weight: 500;
    color: var(--color-snow-white);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.sponsor-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-snow-white);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Info Button */
.info-button {
    background: var(--color-frost);
    border: 1px solid var(--color-frost-border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-snow-white);
    margin-left: auto;
}

.info-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px var(--spacing-md) 80px;
    min-height: 100vh;
}

/* Chat Container */
.chat-container {
    width: 100%;
    max-width: 800px;
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--color-frost-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 600px;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Custom Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Message Styles */
.message {
    display: flex;
    width: 100%;
}

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

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

.message-bubble {
    max-width: 75%;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--border-radius-md);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--color-frost-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.message-ai .message-bubble {
    background: var(--color-ai-bubble);
    border-bottom-left-radius: 6px;
}

.message-user .message-bubble {
    background: var(--color-user-bubble);
    border-bottom-right-radius: 6px;
}

.message-bubble p,
.message-content p {
    line-height: 1.5;
    font-size: 15px;
    color: #1a1a1a;
    text-shadow: none;
    margin-bottom: 0.5em;
}

.message-content {
    color: #1a1a1a;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    color: #1a1a1a;
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.message-content h2 {
    font-size: 1.3em;
}

.message-content h3 {
    font-size: 1.1em;
}

.message-content ul,
.message-content ol {
    margin-left: 1.5em;
    margin-bottom: 0.5em;
}

.message-content li {
    margin-bottom: 0.3em;
}

.message-content a {
    color: #1976d2;
    text-decoration: underline;
    cursor: pointer;
}

.message-content a:hover {
    color: #1565c0;
}

.message-content strong {
    font-weight: 600;
}

.message-content em {
    font-style: italic;
}

.message-content code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.1);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5em 0;
}

.message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 0.5em 0;
}

.message-content hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 1em 0;
}

/* Prompt Container */
.prompt-container {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--color-frost-border);
}

.prompt-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid var(--color-frost-border);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-snow-white);
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.prompt-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.prompt-input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.send-button {
    background: rgba(100, 181, 246, 0.4);
    border: 1px solid rgba(100, 181, 246, 0.6);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-snow-white);
}

.send-button:hover {
    background: rgba(100, 181, 246, 0.6);
    transform: scale(1.05);
}

/* Footer */
.footer {
    padding: var(--spacing-md);
    text-align: center;
    background: var(--color-frost);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border-top: 1px solid var(--color-frost-border);
}

.footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.footer-link {
    color: var(--color-snow-white);
    text-decoration: none;
    font-size: 14px;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.footer-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.footer-separator {
    opacity: 0.5;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--spacing-md);
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--color-frost);
    backdrop-filter: blur(var(--blur-amount));
    -webkit-backdrop-filter: blur(var(--blur-amount));
    border: 1px solid var(--color-frost-border);
    border-radius: var(--border-radius-lg);
    max-width: 600px;
    width: 100%;
    padding: var(--spacing-lg);
    position: relative;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.3);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--color-frost-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--color-snow-white);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-content h2 {
    font-size: 28px;
    margin-bottom: var(--spacing-md);
    font-weight: 600;
}

.modal-content h3 {
    font-size: 20px;
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.modal-body p {
    line-height: 1.6;
    margin-bottom: var(--spacing-sm);
    opacity: 0.9;
}

.modal-body ul {
    list-style: none;
    padding: 0;
    margin: var(--spacing-sm) 0;
}

.modal-body li {
    padding: var(--spacing-xs) 0;
    line-height: 1.6;
    opacity: 0.9;
}

.modal-body li strong {
    font-weight: 600;
}

.modal-body a {
    color: #ffffff;
    text-decoration: underline;
    font-weight: 500;
}

.modal-body a:hover {
    color: #64b5f6;
}

.modal-tagline {
    margin-top: var(--spacing-md);
    font-style: italic;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: var(--spacing-sm);
        height: auto;
        flex-wrap: wrap;
    }
    
    .header-left,
    .header-center,
    .header-right {
        flex: none;
    }
    
    .header-center {
        order: 3;
        width: 100%;
        margin-top: var(--spacing-sm);
    }
    
    .sponsor-banner {
        width: 100%;
        justify-content: center;
    }
    
    .logo {
        height: 32px;
    }
    
    .main-content {
        padding: 140px var(--spacing-sm) 60px;
    }
    
    .chat-container {
        height: 500px;
        border-radius: var(--border-radius-md);
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    .modal-content {
        margin: var(--spacing-sm);
    }
    
    .footer-links {
        font-size: 12px;
    }
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: var(--spacing-sm) var(--spacing-lg);
    justify-content: flex-start;
}

.typing-dots {
    display: flex;
    gap: 6px;
    padding: 12px 20px;
    background: var(--color-ai-bubble);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: var(--border-radius-md);
    border-bottom-left-radius: 6px;
    border: 1px solid var(--color-frost-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: rgba(26, 26, 26, 0.5);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite;
}

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

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

@keyframes typingAnimation {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Error Message */
.error-message {
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0 var(--spacing-md);
    background: rgba(244, 67, 54, 0.9);
    color: white;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    text-align: center;
    display: none;
}

/* Chat Counter */
.chat-counter {
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0;
    color: var(--color-snow-white);
    font-size: 12px;
    text-align: center;
    font-weight: 400;
    letter-spacing: 0.3px;
}

/* Unit Cards */
.unit-card {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.unit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.unit-card h2,
.unit-card h3 {
    margin-top: 0;
    cursor: pointer;
    transition: color 0.2s ease;
}

.unit-card h2:hover,
.unit-card h3:hover {
    color: #1565c0;
}

.unit-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
}

.unit-title {
    cursor: pointer;
    transition: color 0.2s ease;
}

.unit-title:hover {
    color: #1565c0;
}

.unit-number-link {
    cursor: pointer;
    color: #1976d2;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.unit-number-link:hover {
    color: #1565c0;
}

@media (max-width: 480px) {
    .chat-messages {
        padding: var(--spacing-md);
    }
    
    .prompt-container {
        padding: var(--spacing-sm);
    }
    
    .sponsor-text {
        font-size: 12px;
    }
    
    .sponsor-label {
        font-size: 10px;
    }
    
    .sponsor-name {
        font-size: 13px;
    }
    
    .typing-indicator {
        padding: var(--spacing-sm) var(--spacing-md);
    }
}

