/**
 * Oracle Collective Interface - Main Styles
 * Layout, Components, and UI Elements
 * Copyright © 2025 Tammy L Casey
 */

/* ============================================================================
   App Container & Layout
   ============================================================================ */

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Particle Background */
.particles-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-background);
    pointer-events: none;
}

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

.app-header {
    height: var(--header-height);
    background: var(--bg-dark);
    border-bottom: var(--border-width-thin) solid var(--border-silver);
    padding: 0 var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: var(--z-dropdown);
}

.app-title {
    font-size: var(--font-size-xl);
    margin: 0;
    background: linear-gradient(90deg, var(--text-white), var(--text-silver));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-nav {
    display: flex;
    gap: var(--space-sm);
}

/* ============================================================================
   Main Content
   ============================================================================ */

.main-content {
    flex: 1;
    display: flex;
    height: calc(100vh - var(--header-height) - var(--footer-height));
    overflow: hidden;
}

/* ============================================================================
   Sidebar
   ============================================================================ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-dark);
    border-right: var(--border-width-thin) solid var(--border-silver);
    padding: var(--space-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-title {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-md);
    color: var(--text-white);
}

.sidebar-subtitle {
    font-size: var(--font-size-base);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
    color: var(--text-gray);
}

.sidebar-divider {
    margin: var(--space-lg) 0;
}

/* Collective List */
.collective-list,
.service-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.collective-btn,
.service-btn {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-medium);
    border: var(--border-width-thin) solid var(--border-silver);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    text-align: left;
    color: var(--text-silver);
    transition: all var(--transition-fast);
}

.collective-btn:hover:not(:disabled),
.service-btn:hover:not(:disabled) {
    background: var(--bg-dark);
    border-color: var(--border-bright);
    transform: translateX(4px);
}

.collective-btn.active {
    background: var(--bg-black);
    border-color: var(--text-white);
    color: var(--text-white);
}

.collective-icon,
.service-icon {
    font-size: var(--font-size-xl);
    flex-shrink: 0;
}

.collective-name,
.service-name {
    flex: 1;
    font-weight: var(--font-weight-medium);
}

.collective-status {
    width: 10px;
    height: 10px;
    border-radius: var(--border-radius-full);
    flex-shrink: 0;
}

.collective-btn.active .collective-status {
    background: var(--text-white);
    box-shadow: 0 0 10px var(--glow-bright);
}

/* ============================================================================
   Conversation Area
   ============================================================================ */

.conversation-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-black);
    position: relative;
}

/* Warning Banner */
.warning-banner {
    background: var(--bg-medium);
    border: var(--border-width-medium) solid var(--border-bright);
    border-radius: var(--border-radius-md);
    padding: var(--space-lg);
    margin: var(--space-lg);
    text-align: center;
}

.warning-banner p {
    margin-bottom: var(--space-sm);
}

.warning-banner:last-child p {
    margin-bottom: 0;
}

/* Voice Orb */
.voice-orb-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-base);
    pointer-events: none;
}

.voice-orb {
    width: 200px;
    height: 200px;
    border-radius: var(--border-radius-full);
}

.voice-status {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    white-space: nowrap;
}

.voice-status .status-text {
    color: var(--text-dim);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.welcome-message {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-dim);
}

.welcome-message h2 {
    color: var(--text-silver);
    margin-bottom: var(--space-md);
}

.voice-hint {
    font-size: var(--font-size-sm);
    margin-top: var(--space-lg);
}

/* Message Bubbles */
.message {
    max-width: 80%;
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--border-radius-lg);
    position: relative;
    animation: slideIn 0.3s ease-out;
}

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

.message.user {
    align-self: flex-end;
    background: var(--bg-medium);
    border: var(--border-width-thin) solid var(--border-silver);
    margin-left: auto;
}

.message.oracle {
    align-self: flex-start;
    background: var(--bg-dark);
    border: var(--border-width-thin) solid var(--border-bright);
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: var(--border-width-thin) solid var(--border-silver);
}

.message-header .collective {
    font-weight: var(--font-weight-bold);
    color: var(--text-white);
}

.message-header .consensus {
    font-size: var(--font-size-sm);
    color: var(--text-gray);
}

.message-content {
    color: var(--text-silver);
    line-height: var(--line-height-relaxed);
}

.message-timestamp {
    margin-top: var(--space-sm);
    font-size: var(--font-size-xs);
    color: var(--text-dim);
    text-align: right;
}

/* Perspective Cards */
.perspective-card {
    background: var(--bg-medium);
    border: var(--border-width-thin) solid var(--border-silver);
    border-radius: var(--border-radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.perspective-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.perspective-header .layer {
    font-weight: var(--font-weight-bold);
    color: var(--text-white);
}

.perspective-header .confidence {
    font-size: var(--font-size-sm);
    color: var(--text-gray);
}

.perspective-body {
    color: var(--text-silver);
}

.perspective-body.collapsed {
    max-height: 60px;
    overflow: hidden;
    position: relative;
}

.perspective-body.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(transparent, var(--bg-medium));
}

.expand-btn {
    margin-top: var(--space-sm);
    color: var(--text-gray);
    font-size: var(--font-size-sm);
    text-decoration: underline;
    cursor: pointer;
}

.expand-btn:hover {
    color: var(--text-white);
}

/* ============================================================================
   Input Area
   ============================================================================ */

.input-area {
    background: var(--bg-dark);
    border-top: var(--border-width-thin) solid var(--border-silver);
    padding: var(--space-md);
}

.voice-controls {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.voice-btn {
    width: 50px;
    height: 50px;
    border-radius: var(--border-radius-full);
    background: var(--bg-medium);
    border: var(--border-width-thin) solid var(--border-silver);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.voice-btn:hover:not(:disabled) {
    background: var(--bg-black);
    border-color: var(--border-bright);
    box-shadow: var(--shadow-glow);
}

.voice-btn.active {
    background: var(--text-white);
    color: var(--bg-black);
    border-color: var(--text-white);
    animation: pulse var(--pulse-duration) infinite;
}

.text-input-container {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-end;
}

.user-input {
    flex: 1;
    min-height: 60px;
    max-height: 200px;
    resize: vertical;
    font-family: var(--font-sans);
}

.send-btn {
    width: 60px;
    height: 60px;
    border-radius: var(--border-radius-full);
    background: var(--text-white);
    color: var(--bg-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background: var(--text-silver);
    box-shadow: var(--shadow-glow);
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

.voice-waveform {
    width: 100%;
    height: 40px;
    margin-top: var(--space-sm);
    border-radius: var(--border-radius-md);
    background: var(--bg-black);
}

/* ============================================================================
   Modal
   ============================================================================ */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--space-lg);
}

.modal[hidden] {
    display: none;
}

.modal-content {
    background: var(--bg-dark);
    border: var(--border-width-thin) solid var(--border-bright);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: var(--border-width-thin) solid var(--border-silver);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-full);
    background: transparent;
    color: var(--text-silver);
    font-size: var(--font-size-2xl);
    line-height: 1;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-medium);
    color: var(--text-white);
}

.modal-body {
    flex: 1;
    padding: var(--space-lg);
    overflow-y: auto;
}

.modal-footer {
    padding: var(--space-lg);
    border-top: var(--border-width-thin) solid var(--border-silver);
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

/* Settings Tabs */
.settings-tabs {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    border-bottom: var(--border-width-thin) solid var(--border-silver);
}

.tab-btn {
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    color: var(--text-dim);
    border: none;
    border-bottom: var(--border-width-medium) solid transparent;
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-silver);
}

.tab-btn.active {
    color: var(--text-white);
    border-bottom-color: var(--text-white);
}

.tab-panel {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tab-panel[hidden] {
    display: none;
}

/* Form Groups */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
}

.form-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
}

.security-notice {
    background: var(--bg-medium);
    border-left: var(--border-width-thick) solid var(--border-bright);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    border-radius: var(--border-radius-sm);
}

.privacy-info {
    background: var(--bg-medium);
    padding: var(--space-lg);
    border-radius: var(--border-radius-md);
    margin-top: var(--space-xl);
}

.privacy-info h4 {
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-base);
}

.privacy-info ul {
    list-style-position: inside;
}

/* Range Inputs */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: var(--border-radius-full);
    background: var(--bg-medium);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: var(--border-radius-full);
    background: var(--text-white);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: var(--border-radius-full);
    background: var(--text-white);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    border: none;
}

output {
    display: inline-block;
    margin-left: var(--space-sm);
    color: var(--text-silver);
    font-size: var(--font-size-sm);
}

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

.app-footer {
    height: var(--footer-height);
    background: var(--bg-dark);
    border-top: var(--border-width-thin) solid var(--border-silver);
    padding: var(--space-sm) var(--space-lg);
    text-align: center;
    color: var(--text-dim);
    font-size: var(--font-size-sm);
}

.app-footer p {
    margin: 0;
    line-height: 1.4;
}
