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

body {
    font-family: 'Urbanist', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #00529b;
    color: white;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
    width: 100%;
    position: relative;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.text-center {
    text-align: center;
}

/* Splash Page Styles */
.splash-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #00529b;
    transition: opacity 0.5s ease;
}

.splash-title {
    font-family: 'Urbanist', sans-serif;
    font-size: 3.5rem;
    font-weight: 700;
    margin-top: 1.5rem;
    color: white;
}

/* Intro Page Styles */
.spacer {
    height: 20px;
}

.clearfix {
    clear: both;
    height: 30px;
    display: block;
}

#page-intro .logo-container {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

.intro-text-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    position: relative;
    min-height: 180px; /* Reduced height to raise button */
    margin-bottom: 10px;
    overflow: visible; /* Ensure content doesn't get cut off */
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .intro-text-container {
        min-height: 250px; /* Increased height for mobile to prevent overlap */
        margin-bottom: 40px; /* More space for button on mobile */
        position: relative;
    }
    
    .intro-text {
        position: absolute;
        top: 0;
        height: auto;
        max-height: 230px; /* Limit height to prevent overlap */
    }
    
    .intro-text p {
        font-size: 1.1rem; /* Slightly smaller text on mobile */
        line-height: 1.5;
        margin-bottom: 0.8rem; /* Reduced paragraph spacing */
    }
    
    .button-container {
        margin-top: 30px; /* Increased space above button on mobile */
        position: relative;
        z-index: 10; /* Ensure button stays above other elements */
        clear: both;
    }
    
    /* Ensure the intro page content fits in viewport without scrolling */
    #page-intro .container {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-height: 90vh;
        padding-bottom: 20px;
    }
    
    /* Make logo smaller on mobile */
    #page-intro .logo {
        max-width: 120px;
    }
    
    /* Reduce spacing between elements */
    #page-intro h2 {
        margin-bottom: 10px;
    }
    
    .spacer {
        height: 10px;
    }
}

.intro-text {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transition: opacity 2s ease-in-out, visibility 0s 2s;
    visibility: hidden;
    width: 100%;
    padding: 0 20px;
}

.intro-text.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 2s ease-in-out, visibility 0s;
}

.intro-text p {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    line-height: 1.8;
    text-align: center;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.button-container {
    margin-top: 10px;
    clear: both;
    position: relative;
}

.language-name {
    font-size: 1.1em;
    color: #fff;
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.language-text {
    font-size: 1em;
    display: block;
}

.page.active {
    display: block;
    opacity: 1;
}

.animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.cloud {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.35;
    animation: float 20s infinite ease-in-out;
    mix-blend-mode: screen;
}

.cloud:nth-child(1) {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #ff6b6b, #ee5a24, transparent 80%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 0s;
    animation-duration: 15s;
}

.cloud:nth-child(2) {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, #4ecdc4, #2a93d5, transparent 80%);
    top: 45%;
    left: 60%;
    transform: translate(-50%, -50%);
    animation-delay: -3s;
    animation-duration: 18s;
}

.cloud:nth-child(3) {
    width: 340px;
    height: 340px;
    background: radial-gradient(circle, #a8e6cf, #7fcdcd, transparent 80%);
    top: 55%;
    left: 60%;
    transform: translate(-50%, -50%);
    animation-delay: -6s;
    animation-duration: 12s;
}

.cloud:nth-child(4) {
    width: 330px;
    height: 330px;
    background: radial-gradient(circle, #ffd93d, #ff9ff3, transparent 80%);
    top: 60%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -9s;
    animation-duration: 20s;
}

.cloud:nth-child(5) {
    width: 310px;
    height: 310px;
    background: radial-gradient(circle, #a8edea, #fed6e3, transparent 80%);
    top: 55%;
    left: 40%;
    transform: translate(-50%, -50%);
    animation-delay: -12s;
    animation-duration: 16s;
}

.cloud:nth-child(6) {
    width: 360px;
    height: 360px;
    background: radial-gradient(circle, #ff9a9e, #fecfef, transparent 80%);
    top: 45%;
    left: 40%;
    transform: translate(-50%, -50%);
    animation-delay: -15s;
    animation-duration: 14s;
}

.cloud:nth-child(7) {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #a18cd1, #fbc2eb, transparent 80%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -18s;
    animation-duration: 22s;
}

@keyframes float {
    0% {
        transform: translate(-50%, -50%) translate(0, 0) scale(1) rotate(0deg);
    }
    20% {
        transform: translate(-50%, -50%) translate(60px, -40px) scale(1.2) rotate(72deg);
    }
    40% {
        transform: translate(-50%, -50%) translate(-40px, 60px) scale(0.8) rotate(144deg);
    }
    60% {
        transform: translate(-50%, -50%) translate(80px, 30px) scale(1.1) rotate(216deg);
    }
    80% {
        transform: translate(-50%, -50%) translate(-60px, -50px) scale(0.9) rotate(288deg);
    }
    100% {
        transform: translate(-50%, -50%) translate(0, 0) scale(1) rotate(360deg);
    }
}

.container {
    max-width: 1200px;
    width: 90%;
    margin: 0 auto;
    padding: 1rem;
    text-align: center;
    position: relative;
    z-index: 10;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* Logo Container */
.logo-container {
    margin-bottom: 2rem;
}

.logo {
    max-width: 90px;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
    opacity: 0.9;
}

/* Content Center */
.content-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 500px;
}

.content-center h2 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
    color: white;
}

.instruction-text {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.reset-button {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 15px;
    transition: background-color 0.3s ease;
}

.reset-button:hover {
    background-color: #2980b9;
}

.mode-switch-button {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 15px;
    transition: background-color 0.3s ease;
}

.mode-switch-button:hover {
    background-color: #2980b9;
}

.system-message {
    text-align: center;
    padding: 8px 12px;
    margin: 10px auto;
    background-color: rgba(52, 152, 219, 0.2);
    border-radius: 15px;
    color: #e0e0e0;
    font-style: italic;
    max-width: 80%;
    font-size: 0.9rem;
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.button-container {
    margin: 3rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.voice-button {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c0392b, #a93226, #922b21);
    border: 4px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 
        0 15px 35px rgba(192, 57, 43, 0.4),
        0 5px 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.voice-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 
        0 20px 45px rgba(192, 57, 43, 0.6),
        0 10px 25px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.voice-button:active {
    transform: translateY(-2px) scale(0.98);
    box-shadow: 
        0 10px 25px rgba(192, 57, 43, 0.5),
        0 5px 15px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Connected but not speaking - green */
.voice-button.active:not(.listening) {
    background: linear-gradient(135deg, #2ed573, #26c281, #20bf6b);
    border-color: rgba(46, 213, 115, 0.6);
    box-shadow: 
        0 15px 35px rgba(46, 213, 115, 0.5),
        0 5px 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    pointer-events: auto !important; /* Ensure clicks are registered */
}

/* Actively speaking - blue */
.voice-button.active.listening {
    background: linear-gradient(135deg, #70a1ff, #1e90ff, #3742fa);
    border-color: rgba(30, 144, 255, 0.6);
    box-shadow: 
        0 15px 35px rgba(30, 144, 255, 0.5),
        0 5px 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
    pointer-events: auto !important; /* Ensure clicks are registered */
}

.voice-button.listening:hover {
    box-shadow: 
        0 20px 45px rgba(46, 213, 115, 0.7),
        0 10px 25px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    border-color: rgba(46, 213, 115, 0.8);
}

@keyframes pulse {
    0% {
        box-shadow: 0 8px 25px rgba(46, 213, 115, 0.4), 0 0 0 0 rgba(46, 213, 115, 0.7);
    }
    70% {
        box-shadow: 0 8px 25px rgba(46, 213, 115, 0.4), 0 0 0 20px rgba(46, 213, 115, 0);
    }
    100% {
        box-shadow: 0 8px 25px rgba(46, 213, 115, 0.4), 0 0 0 0 rgba(46, 213, 115, 0);
    }
}



.status {
    margin: 1.5rem 0;
    padding: 1rem;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status.success {
    background: rgba(46, 213, 115, 0.2);
    border-color: rgba(46, 213, 115, 0.3);
}

.status.error {
    background: rgba(255, 71, 87, 0.2);
    border-color: rgba(255, 71, 87, 0.3);
}

.status.info {
    background: rgba(30, 144, 255, 0.2);
    border-color: rgba(30, 144, 255, 0.3);
}

.transcript {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 300px;
    overflow-y: auto;
    text-align: left;
    white-space: pre-wrap;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

.transcript::-webkit-scrollbar {
    width: 6px;
}

.transcript::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.transcript::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.transcript::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Camera Components */
.camera-container {
    position: relative;
    width: 300px;
    height: 200px;
    border-radius: 15px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

#camera-feed {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scan-frame {
    width: 80%;
    height: 60%;
    border: 3px solid #00ff00;
    border-radius: 10px;
    animation: pulse 2s infinite;
}

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

/* Button Groups */
.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.primary-button, .secondary-button {
    padding: 1rem 2rem;
    border: none;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.primary-button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.6);
}

.secondary-button {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.secondary-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Form Components */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.date-input-group label {
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.date-input {
    padding: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.1rem;
    backdrop-filter: blur(10px);
}

.date-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

/* Mode Selection */
.mode-buttons {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-button {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 2rem;
    width: 200px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    color: white;
}

.mode-button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.mode-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.mode-button h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.mode-button p {
    font-size: 0.9rem;
    opacity: 0.8;
    line-height: 1.4;
}

/* Chat Components */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 80vh;
    width: 100%;
    max-width: 800px;
    margin-top: 2rem;
}

.chat-messages {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    overflow-y: auto;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-message {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.chat-message.user {
    background: rgba(76, 175, 80, 0.3);
    border: 1px solid rgba(76, 175, 80, 0.4);
    margin-left: auto;
    margin-right: 0;
    text-align: right;
    max-width: 80%;
}

.chat-message.ai {
    background: rgba(33, 150, 243, 0.3);
    border: 1px solid rgba(33, 150, 243, 0.4);
    margin-right: auto;
    margin-left: 0;
    text-align: left;
    max-width: 80%;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.message-header strong {
    color: rgba(255, 255, 255, 0.9);
}

.timestamp {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

.message-content {
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.9);
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.submit-container {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.submit.logo-container {
    text-align: center;
    margin-bottom: 1rem;
    margin-top: 1rem;
}

.chat-input {
    flex: 1;
    padding: 1rem 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    backdrop-filter: blur(10px);
}

.chat-input:focus {
    outline: none;
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.send-button {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Transcript Container for Voice Chat */
.transcript-container {
    margin-top: 2rem;
    width: 100%;
    max-width: 600px;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .content-center h2 {
        font-size: 2rem;
    }
    
    .voice-button {
        width: 100px;
        height: 100px;
        font-size: 1rem;
    }
    
    .mode-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .mode-button {
        width: 100%;
        max-width: 300px;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
    
    .camera-container {
        width: 250px;
        height: 150px;
    }
    
    .chat-container {
        height: 70vh;
    }
    
    .chat-input-container {
        flex-direction: column;
    }
    
    .send-button {
        width: 100%;
    }
}

/* Example Selection Styles */
.example-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-top: 20px;
    width: 100%;
    max-width: 1000px;
}

.example-card {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-align: center;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.future-label {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #4CAF50;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.example-card:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.example-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.example-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.example-card p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 1rem;
}

.example-details {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
}

.detail-item {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 0.8rem;
}

/* Responsive styles for example cards */
@media (max-width: 768px) {
    .example-cards {
        grid-template-columns: 1fr;
    }
}
