/* 
 * IntentOS Premium Design System
 * Inspired by Glassmorphism and Apple's Dark Mode 
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Outfit:wght@400;600;800&display=swap');

:root {
    --bg-dark: #0a0c12; /* Deep Obsidian */
    --glass-bg: rgba(30, 41, 59, 0.4); /* Slate with opacity */
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.6);
    --secondary: #ec4899; /* Pink */
    --accent-green: #10b981; /* Emerald */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.8);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 15% 15%, rgba(99, 102, 241, 0.2) 0px, transparent 45%),
        radial-gradient(at 85% 85%, rgba(236, 72, 153, 0.2) 0px, transparent 45%);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.container {
    width: 100%;
    max-width: 950px;
    z-index: 10;
}

header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

h1 {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    display: inline-block;
}

h1 span {
    color: var(--primary);
    -webkit-text-fill-color: var(--primary);
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.user-badge img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--primary);
}

.user-badge span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

.hidden { display: none !important; }

/* OS Tag removed in v3 for spanned logo */

.subtitle {
    color: var(--text-muted);
    font-size: 1.25rem;
    font-weight: 300;
    margin-top: 1rem;
}

/* Glass Interface */
.glass-ui {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 2.5rem;
    box-shadow: var(--card-shadow);
}

/* Toolbar & Chips */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
}

select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
    transition: border 0.3s;
}

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

.location-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    border: 1px solid var(--glass-border);
}

.location-chip .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444; /* Default red */
    box-shadow: 0 0 10px #ef4444;
}

.location-chip.active .dot {
    background: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.icon-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.audio-verify {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

audio {
    width: 100%;
    filter: invert(100%) hue-rotate(180deg) brightness(1.5); /* Theme audio player to dark glassmorphic */
    border-radius: 8px;
}

textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    color: white;
    font-size: 1.1rem;
    line-height: 1.6;
    font-family: var(--font-body);
    resize: none;
    margin-bottom: 1rem;
    transition: all 0.3s cubic-bezier(0.1, 0.7, 0.6, 1);
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 25px var(--primary-glow);
    background: rgba(0, 0, 0, 0.45);
}

.emergency-emails {
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.emergency-emails label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.email-input-wrapper {
    display: flex;
    gap: 0.75rem;
}

.email-input-wrapper input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    color: white;
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.small-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    border-radius: 8px;
    white-space: nowrap;
}

.contact-status {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Media and Controls */
.media-preview {
    display: flex;
    gap: 10px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.preview-item {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--primary);
    position: relative;
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.media-buttons {
    display: flex;
    gap: 0.75rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.35s ease, background 0.25s ease;
    box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
}

.icon-btn:hover {
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(129, 140, 248, 0.85);
    transform: translateY(-2px);
    box-shadow:
        0 0 0 1px rgba(129, 140, 248, 0.4),
        0 0 26px rgba(99, 102, 241, 0.5),
        0 8px 28px -10px rgba(99, 102, 241, 0.35);
}

.icon-btn.recording {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

button {
    background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
    color: white;
    border: none;
    padding: 1rem 3rem;
    border-radius: 16px;
    font-weight: 700;
    font-family: var(--font-heading);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 8px 20px -5px var(--primary-glow);
}

button:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 30px -5px var(--primary-glow);
}

button:active {
    transform: translateY(-1px) scale(1);
}

button:disabled {
    filter: grayscale(0.8);
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* AI Processing View */
.results-grid {
    margin-top: 3rem;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.5rem;
    opacity: 0;
    transform: translateY(30px);
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
}

.results-grid.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.result-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.75rem;
}

.result-card h3 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.result-card h3::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--glass-border);
}

/* Intent Badges */
.severity-pill {
    padding: 0.3rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.high { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.3); }
.medium { background: rgba(245, 158, 11, 0.1) ; color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.low { background: rgba(16, 185, 129, 0.1); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }

.orchestration-banner {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.65rem 1rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.orchestration-banner--safe {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(52, 211, 153, 0.35);
}

/* Actions List */
.action-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.action-row:last-child {
    border-bottom: none;
}

.action-icon {
    font-size: 1.4rem;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

/* JSON Viewer */
pre {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #a5b4fc;
    line-height: 1.5;
    background: rgba(0, 0, 0, 0.4);
    padding: 1.5rem;
    border-radius: 16px;
    overflow-x: auto;
}

/* Loader Animation */
.ring-loader {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
    display: none;
}

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

@media (max-width: 850px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
    h1 {
        font-size: 2.8rem;
    }
}
