/* ===========================
   Voice AI Agent - Main Styles
   =========================== */

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

:root {
    /* Aurora Color Palette */
    --aurora-navy: #0E2841;
    --aurora-blue: #156082;
    --aurora-bright-blue: #0F9ED5;
    --aurora-orange: #E97132;
    --aurora-gray: #E8E8E8;
    --aurora-green: #196B24;
    --aurora-teal: #467886;
    --aurora-dark-bg: #0a1a2b;

    /* Primary colors mapped to Aurora */
    --primary-color: #0E2841;      /* Aurora Navy */
    --primary-hover: #156082;      /* Aurora Blue */
    --secondary-color: #E97132;    /* Aurora Orange */
    --danger-color: #ef4444;       /* Keep red for recording/errors */
    --bg-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #dee2e6;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===========================
   Header
   =========================== */

.app-header {
    background-color: var(--aurora-navy);
    color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-logo {
    height: 45px;
    width: auto;
    border-radius: 8px;
}

.app-header h1 {
    font-size: 1.4rem;
    font-weight: 500;
    letter-spacing: -0.025em;
    color: white;
}

/* ===========================
   Conversation Header
   =========================== */

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    border-radius: 1rem 1rem 0 0;
}

.conversation-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--aurora-navy);
}

.reset-button {
    background: var(--aurora-orange);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s;
}

.reset-button:hover {
    background: #d96229;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.reset-button:active {
    transform: translateY(0);
}

/* ===========================
   Feature Navigation Tabs
   =========================== */

.feature-nav {
    display: flex;
    gap: 0.5rem;
}

.nav-tab {
    background: transparent;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--aurora-orange);
}

.nav-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--aurora-orange);
}

.nav-tab svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    vertical-align: middle;
}

/* ===========================
   Feature Panels
   =========================== */

.feature-panel {
    display: none;
    width: 100%;
}

.feature-panel.active {
    display: flex;
}

.feature-panel.hidden {
    display: none;
}

/* ===========================
   Main Container
   =========================== */

.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
    gap: 2rem;
}

/* Two Panel Layout (for Voice Chat) */
.feature-panel.two-panel {
    flex-direction: row;
    gap: 2rem;
}

/* Left Panel - Voice Controls */
.left-panel {
    flex: 0 0 350px;
    display: flex;
    flex-direction: column;
}

.voice-control-panel {
    background: var(--surface-color);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    position: sticky;
    top: 2rem;
}

/* Voice Selector */
.voice-selector-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.voice-selector-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding-left: 0.25rem;
}

.voice-selector {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 2.5rem;
    font-size: 0.9375rem;
    line-height: 1.4;
    color: var(--text-primary);
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.voice-selector:hover {
    border-color: var(--aurora-bright-blue);
}

.voice-selector:focus {
    outline: none;
    border-color: var(--aurora-bright-blue);
    box-shadow: 0 0 0 3px rgba(15, 158, 213, 0.2);
}

.voice-selector option {
    padding: 0.75rem 1rem;
    line-height: 1.6;
    white-space: normal;
    word-wrap: break-word;
}

/* Waveform Visualizer */
.waveform-container {
    width: 100%;
    height: 160px;
    background: linear-gradient(to bottom, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
}

.waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Voice Activity Indicator */
.voice-activity {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: 2rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.voice-activity .activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: background 0.3s;
}

.voice-activity.listening .activity-dot {
    background: var(--aurora-orange);
    animation: pulse-dot 1.5s infinite;
}

.voice-activity.speaking .activity-dot {
    background: var(--aurora-bright-blue);
    animation: pulse-dot 0.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.voice-activity .activity-text {
    font-weight: 500;
}

/* Right Panel - Conversation */
.right-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ===========================
   Conversation Container
   =========================== */

.conversation-container {
    flex: 1;
    background: var(--surface-color);
    border-radius: 0 0 1rem 1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 400px;
    max-height: 600px;
}

/* In two-panel mode, conversation takes full height */
.two-panel .conversation-container {
    min-height: 500px;
    max-height: calc(100vh - 200px);
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}

.messages::-webkit-scrollbar {
    width: 8px;
}

.messages::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.welcome-message p {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.help-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Message Bubbles */
.message {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.75rem;
    animation: messageAppear 0.3s ease-out;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, var(--aurora-navy) 0%, var(--aurora-blue) 100%);
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, var(--aurora-orange) 0%, #d96229 100%);
}

.message-bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--aurora-navy);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message.assistant .message-bubble {
    background: var(--aurora-gray);
    color: var(--text-primary);
    border-bottom-left-radius: 0.25rem;
    border: 1px solid var(--border-color);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    opacity: 0.7;
}

/* ===========================
   Voice Control
   =========================== */

.voice-control {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.voice-button {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aurora-navy) 0%, var(--aurora-blue) 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.voice-button:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

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

.voice-button.recording {
    background: linear-gradient(135deg, var(--aurora-orange) 0%, #d96229 100%);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(233, 113, 50, 0.7);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(233, 113, 50, 0);
    }
}

.mic-icon {
    font-size: 2.5rem;
}

.button-text {
    font-size: 0.75rem;
    font-weight: 500;
    text-align: center;
}

/* Recording Indicator */
.recording-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--surface-color);
    border-radius: 2rem;
    box-shadow: var(--shadow);
}

.recording-indicator.hidden {
    display: none;
}

.recording-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--danger-color);
}

/* ===========================
   Status Message
   =========================== */

.status-message {
    position: fixed;
    top: 6rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    max-width: 90%;
    z-index: 1000;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate(-50%, -20px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

.status-message.hidden {
    display: none;
}

.status-message.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.status-message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.status-message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ===========================
   Footer
   =========================== */

.app-footer {
    text-align: center;
    padding: 1.5rem;
    background-color: var(--aurora-dark-bg);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

/* ===========================
   Responsive
   =========================== */

/* Tablet and below */
@media (max-width: 1024px) {
    .main-container.two-panel {
        flex-direction: column;
        max-width: 800px;
    }

    .left-panel {
        flex: 0 0 auto;
    }

    .voice-control-panel {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .voice-selector-container {
        width: 100%;
        order: 0;
    }

    .waveform-container {
        width: 100%;
        height: 80px;
        order: 1;
    }

    .voice-control {
        order: 2;
    }

    .voice-activity {
        order: 3;
    }

    .two-panel .conversation-container {
        max-height: 500px;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 1rem;
    }

    .app-header h1 {
        font-size: 1.25rem;
    }

    .main-container {
        padding: 1rem 0.5rem;
    }

    .main-container.two-panel {
        padding: 1rem 0.5rem;
        gap: 1rem;
    }

    .voice-control-panel {
        padding: 1rem;
        gap: 1rem;
    }

    .waveform-container {
        height: 60px;
    }

    .conversation-container {
        min-height: 300px;
        max-height: 500px;
    }

    .two-panel .conversation-container {
        min-height: 300px;
        max-height: 400px;
    }

    .message-bubble {
        max-width: 85%;
    }

    .voice-button {
        width: 100px;
        height: 100px;
    }

    .mic-icon {
        font-size: 2rem;
    }
}

/* ===========================
   Landing Page Tiles
   =========================== */

.landing-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: calc(100vh - 200px);
    padding: 2rem;
}

.landing-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--aurora-navy);
    margin-bottom: 0.5rem;
    text-align: center;
}

.landing-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    text-align: center;
}

.tiles-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 800px;
    width: 100%;
}

.feature-tile {
    background: var(--surface-color);
    border-radius: 1rem;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 180px;
    text-decoration: none;
    color: inherit;
}

.feature-tile:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 40px rgba(14, 40, 65, 0.15);
    border-color: var(--aurora-bright-blue);
}

.feature-tile:active {
    transform: scale(1.02);
}

.tile-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--aurora-navy) 0%, var(--aurora-blue) 100%);
    transition: all 0.3s ease;
}

.feature-tile:hover .tile-icon {
    transform: scale(1.1);
    background: linear-gradient(135deg, var(--aurora-bright-blue) 0%, var(--aurora-teal) 100%);
}

.tile-icon svg {
    width: 40px;
    height: 40px;
    fill: white;
    stroke: white;
}

.tile-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--aurora-navy);
    text-align: center;
}

.tile-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.4;
}

/* Tile color variants */
.feature-tile.incoming .tile-icon {
    background: linear-gradient(135deg, var(--aurora-green) 0%, #22c55e 100%);
}

.feature-tile.incoming:hover .tile-icon {
    background: linear-gradient(135deg, #22c55e 0%, #4ade80 100%);
}

.feature-tile.outgoing .tile-icon {
    background: linear-gradient(135deg, var(--aurora-blue) 0%, var(--aurora-bright-blue) 100%);
}

.feature-tile.outgoing:hover .tile-icon {
    background: linear-gradient(135deg, var(--aurora-bright-blue) 0%, #38bdf8 100%);
}

.feature-tile.voice-agent .tile-icon {
    background: linear-gradient(135deg, var(--aurora-orange) 0%, #f97316 100%);
}

.feature-tile.voice-agent:hover .tile-icon {
    background: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
}

.feature-tile.pdf-reader .tile-icon {
    background: linear-gradient(135deg, var(--aurora-teal) 0%, #0891b2 100%);
}

.feature-tile.pdf-reader:hover .tile-icon {
    background: linear-gradient(135deg, #0891b2 0%, #22d3ee 100%);
}

/* Landing page responsive */
@media (max-width: 640px) {
    .tiles-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .feature-tile {
        min-height: 150px;
        padding: 1.5rem;
    }

    .tile-icon {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .tile-icon svg {
        width: 30px;
        height: 30px;
    }

    .landing-title {
        font-size: 1.5rem;
    }
}

/* ===========================
   Utility Classes
   =========================== */

.hidden {
    display: none !important;
}
