:root {
    --primary-color: #6200ea;
    --primary-light: #b388ff;
    --primary-dark: #3100a8;
    --accent-color: #00bfa5;
    --background-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --danger-color: #ff5252;
    --success-color: #69f0ae;
    --glass-blur: blur(12px);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    --shadow-lg: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--background-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 24px;
    padding-top: 10px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(to right, #b388ff, #00bfa5);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo span {
    font-size: 2rem;
    color: var(--accent-color);
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 300;
}

/* AI Context Card */
.ai-card {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: rgba(16, 16, 32, 0.95);
    border: 1px solid rgba(0, 255, 204, 0.3);
    border-radius: 15px;
    padding: 15px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    animation: slideUp 0.4s ease-out;
}

.ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #00ffcc;
    font-weight: bold;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.ai-content {
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.4;
}

#closeAiCard {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 1.1rem;
}

@keyframes slideUp {
    from {
        transform: translate(-50%, 100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Input Section (Camera/Upload) */
.video-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
}

.btn-control {
    background: transparent;
    border: none;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}

.btn-control span.material-symbols-rounded {
    font-size: 2rem;
}

.btn-control.danger {
    color: #ff4444;
}

.btn-control:hover {
    opacity: 0.8;
}

.media-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
}

#cameraFeed,
#imagePreview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder-content {
    text-align: center;
    padding: 20px;
}

.icon-large {
    font-size: 4rem;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 12px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

/* Buttons */
.btn {
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(98, 0, 234, 0.4);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-accent {
    background: var(--accent-color);
    color: #000;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 191, 165, 0.4);
}

.btn-accent:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-capture {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 4px solid white;
    cursor: pointer;
    z-index: 10;
}

.btn-capture::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: white;
    border-radius: 50%;
    transition: transform 0.1s;
}

.btn-capture:active::after {
    transform: translate(-50%, -50%) scale(0.9);
}

.btn-icon-float {
    position: absolute;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(4px);
}

.btn-install {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.top-right {
    top: 16px;
    right: 16px;
}

.full-width {
    width: 100%;
    justify-content: center;
}

/* Controls Section */
.controls-section {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--card-border);
    backdrop-filter: var(--glass-blur);
}

.language-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.select-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.select-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 8px;
}

.placeholder-content p {
    color: var(--text-secondary);
    margin-top: 1rem;
}

.error-state {
    color: #ff4444;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.error-state i {
    font-size: 3rem;
    margin-bottom: 10px;
}

select {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    color: white;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    appearance: none;
    /* Custom arrow can be added with bg img */
}

select:focus {
    border-color: var(--primary-light);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    margin-top: 16px;
    transition: transform 0.3s;
}

.btn-icon:hover {
    color: white;
    transform: rotate(180deg);
}

/* Results Section */
.result-card {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--card-border);
}

.result-card.highlight {
    background: rgba(98, 0, 234, 0.1);
    border-color: rgba(98, 0, 234, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
}

.card-actions {
    display: flex;
    gap: 4px;
}

.btn-icon-small {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}

.btn-icon-small:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.btn-icon-small span {
    font-size: 1.1rem;
}

.card-content {
    min-height: 40px;
    font-family: 'Hind', sans-serif;
    /* Great for Indian scripts */
    font-size: 1.1rem;
    font-size: 1.1rem;
    white-space: pre-wrap;
}

.interactive-word {
    display: inline-block;
}

.dict-match {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--accent-color);
    text-underline-offset: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.dict-match:hover {
    background: rgba(0, 191, 165, 0.2);
    border-radius: 4px;
}

.large-text {
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.4;
}

.divider {
    display: flex;
    justify-content: center;
    color: var(--text-secondary);
    opacity: 0.5;
    margin: 10px 0;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loader {
    width: 48px;
    height: 48px;
    border: 5px solid #FFF;
    border-bottom-color: var(--accent-color);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
    margin-bottom: 16px;
}

#loadingText {
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 480px) {
    .app-container {
        padding: 16px;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .icon-large {
        font-size: 3rem;
    }

    .icon-large {
        font-size: 3rem;
    }
}

/* Geo-Lipi Map */
.map-section {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 20px;
    backdrop-filter: var(--glass-blur);
    animation: fadeIn 0.5s ease;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.section-header h2 {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-color);
}

#mapContainer {
    height: 300px;
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    z-index: 1;
    /* Keep below overlays */
}

.map-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 8px;
}