/* AndrewsBrain - Executive Intelligence Platform Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-dark: rgba(0,0,0,0.1);
    --card-bg: rgba(255,255,255,0.15);
    --card-border: rgba(255,255,255,0.2);
    --text-primary: #fff;
    --text-secondary: rgba(255,255,255,0.8);
    --positive: #4CAF50;
    --negative: #f44336;
    --neutral: #FFC107;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    min-height: -webkit-fill-available;
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

html {
    height: -webkit-fill-available;
}

/* Container */
.container {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    background: var(--bg-dark);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding-bottom: calc(80px + var(--safe-bottom));
}

/* Loading Screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 20px;
}

.loading-brain {
    font-size: 64px;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-text {
    font-size: 18px;
    font-weight: 600;
    opacity: 0.9;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Header */
.header {
    padding: 60px 20px 20px;
    text-align: center;
    background: linear-gradient(180deg, rgba(0,0,0,0.3) 0%, transparent 100%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.8;
    font-weight: 500;
}

.back-button {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 16px;
}

.back-button:active {
    background: rgba(255,255,255,0.3);
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin: 0 20px 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--card-border);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
}

.card-icon {
    font-size: 20px;
    margin-right: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* Section Title */
.section-title {
    font-size: 18px;
    font-weight: 700;
    margin: 20px 24px 16px;
}

/* Brain Switcher */
.brain-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.brain-card {
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.brain-card.active {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: scale(1.02);
}

.brain-card:active {
    transform: scale(0.98);
}

.brain-icon {
    font-size: 28px;
    margin-bottom: 8px;
    display: block;
}

.brain-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
}

.current-brain {
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    font-size: 14px;
}

/* Category Items */
.category-items {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.category-item {
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.category-item:active {
    background: rgba(255,255,255,0.3);
}

/* Search Box */
.search-box {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 12px;
    padding: 16px;
    width: 100%;
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 16px;
    outline: none;
}

.search-box::placeholder {
    color: rgba(255,255,255,0.7);
}

/* Quick Actions / Tags */
.quick-actions,
.filter-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-action,
.filter-tag {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.quick-action:active,
.filter-tag:active,
.filter-tag.active {
    background: rgba(255,255,255,0.35);
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--card-bg);
    border-radius: 12px;
    padding: 4px;
    margin: 20px;
    border: 1px solid var(--card-border);
}

.tab {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tab.active {
    background: rgba(255,255,255,0.3);
}

/* Market Overview */
.market-overview {
    text-align: center;
    margin-bottom: 20px;
}

.main-value {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
}

.change-indicator {
    font-size: 16px;
    font-weight: 600;
}

.change-indicator.positive { color: var(--positive); }
.change-indicator.negative { color: var(--negative); }

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.metric {
    text-align: center;
}

.metric-value {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.metric-label {
    font-size: 12px;
    opacity: 0.8;
}

/* Holdings / List Items */
.holding-item,
.agent-item,
.trending-item,
.insight-item {
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
}

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

.holding-left,
.agent-info {
    flex: 1;
}

.holding-symbol {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.holding-name {
    font-size: 12px;
    opacity: 0.8;
}

.holding-right {
    text-align: right;
}

.holding-value {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.holding-change {
    font-size: 13px;
    font-weight: 600;
}

.holding-change.positive { color: var(--positive); }
.holding-change.negative { color: var(--negative); }

.holding-details {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    opacity: 0.9;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Agent Status */
.agent-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.agent-role {
    font-size: 12px;
    opacity: 0.8;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online { background: var(--positive); }
.status-dot.offline { background: var(--negative); }
.status-dot.idle { background: var(--neutral); }

.agent-metrics {
    display: flex;
    gap: 12px;
    font-size: 12px;
    opacity: 0.9;
    margin-top: 8px;
}

/* Trending Items */
.trending-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.trending-topic {
    font-size: 16px;
    font-weight: 600;
}

.trending-volume {
    font-size: 12px;
    opacity: 0.8;
    background: rgba(255,255,255,0.2);
    padding: 4px 8px;
    border-radius: 8px;
}

.trending-description {
    font-size: 13px;
    opacity: 0.9;
    line-height: 1.4;
    margin-bottom: 8px;
}

.trending-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.trending-tag {
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 500;
}

/* Sentiment Overview */
.sentiment-overview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.sentiment-item {
    text-align: center;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
}

.sentiment-value {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.sentiment-value.positive { color: var(--positive); }
.sentiment-value.negative { color: var(--negative); }
.sentiment-value.neutral { color: var(--neutral); }

.sentiment-label {
    font-size: 12px;
    opacity: 0.8;
}

/* Insight Items */
.insight-header {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.insight-icon {
    font-size: 16px;
    margin-right: 8px;
}

.insight-type {
    font-size: 13px;
    font-weight: 600;
}

.insight-text {
    font-size: 13px;
    line-height: 1.4;
    opacity: 0.9;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 20px;
}

.action-button {
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 12px;
    padding: 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.action-button:active {
    transform: scale(0.98);
    background: rgba(255,255,255,0.3);
}

.action-button.primary {
    background: var(--primary-gradient);
}

/* Army Command Stats */
.army-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-item {
    text-align: center;
    padding: 16px 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 12px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    opacity: 0.8;
    line-height: 1.3;
}

/* Task Queue */
.task-item {
    display: flex;
    align-items: center;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    margin-bottom: 8px;
}

.task-priority {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 12px;
}

.task-priority.high { background: var(--negative); }
.task-priority.medium { background: var(--neutral); }
.task-priority.low { background: var(--positive); }

.task-info {
    flex: 1;
}

.task-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.task-agent {
    font-size: 12px;
    opacity: 0.7;
}

.task-time {
    font-size: 11px;
    opacity: 0.6;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 20px;
    padding-bottom: calc(12px + var(--safe-bottom));
    display: flex;
    justify-content: space-around;
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 100;
}

.nav-item {
    text-align: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 12px;
    transition: all 0.2s;
    flex: 1;
}

.nav-item.active {
    background: rgba(255,255,255,0.15);
}

.nav-item:active {
    transform: scale(0.95);
}

.nav-icon {
    font-size: 22px;
    margin-bottom: 4px;
    display: block;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
}

/* Data refresh indicator */
.refresh-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
    opacity: 0.7;
    padding: 8px;
}

.refresh-dot {
    width: 6px;
    height: 6px;
    background: var(--positive);
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* Hide screen by default */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease;
}

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

/* Price update flash */
.price-update {
    animation: priceFlash 0.5s ease;
}

@keyframes priceFlash {
    0% { background: rgba(255,255,255,0.3); }
    100% { background: transparent; }
}
