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

:root {
    --bg-main: #040508;
    --bg-card: rgba(13, 17, 28, 0.7);
    --bg-glass: rgba(22, 28, 45, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Neon Status Indicators */
    --color-primary: hsl(190, 100%, 50%);    /* Neon Cyan */
    --color-success: hsl(142, 72%, 45%);     /* Neon Green */
    --color-warning: hsl(37, 98%, 53%);      /* Neon Orange */
    --color-danger: hsl(354, 70%, 54%);      /* Neon Red */
    --color-purple: hsl(272, 85%, 60%);      /* Neon Violet */
    
    --glow-primary: 0 0 10px rgba(6, 182, 212, 0.4);
    --glow-success: 0 0 10px rgba(34, 197, 94, 0.4);
    --glow-warning: 0 0 10px rgba(249, 115, 22, 0.4);
    --glow-purple: 0 0 10px rgba(168, 85, 247, 0.4);
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --touch-target: 44px;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: 80px; /* Safe space for bottom navigation bar on mobile */
    min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}

/* Glassmorphism utility card */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: var(--transition-smooth);
}
.glass-panel:hover {
    border-color: var(--border-hover);
}

/* --- SECURITY OVERLAY (PIN LOCK SCREEN) --- */
#pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #020305;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease;
}

#pin-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.pin-container {
    text-align: center;
    width: 90%;
    max-width: 340px;
}

.pin-logo {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

.pin-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.pin-display {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 40px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border-hover);
    transition: var(--transition-smooth);
}

.pin-dot.active {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: var(--glow-primary);
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.keypad-btn {
    height: 70px;
    width: 70px;
    border-radius: 50%;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    margin: 0 auto;
    transition: var(--transition-smooth);
    user-select: none;
}
.keypad-btn:active {
    background-color: rgba(255, 255, 255, 0.1);
    transform: scale(0.92);
}
.keypad-btn.action {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.pin-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    margin-top: 20px;
    height: 20px;
    opacity: 0;
    transition: var(--transition-smooth);
}
.pin-error.visible {
    opacity: 1;
}

/* --- TOP HEADER BAR --- */
header {
    background-color: rgba(4, 5, 8, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--color-primary) 0%, #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge-system {
    background-color: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--color-success);
    box-shadow: var(--glow-success);
}
.status-dot.sync-pending {
    background-color: var(--color-warning);
    box-shadow: var(--glow-warning);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* --- TAB CONTAINER SWITCHER --- */
.tab-content {
    display: none;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeIn 0.4s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* --- TAB 1: OVERVIEW & SEGMENTS --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.segment-card {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.progress-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-purple) 100%);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 5px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.88rem;
    color: var(--text-secondary);
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.task-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    min-width: 18px;
    height: 18px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    position: relative;
    top: 2px;
    transition: var(--transition-smooth);
}
.task-item input[type="checkbox"]:checked {
    background-color: var(--color-success);
    border-color: var(--color-success);
}
.task-item input[type="checkbox"]:checked::after {
    content: "✓";
    font-size: 12px;
    color: #fff;
    position: absolute;
    top: -2px;
    left: 3px;
    font-weight: bold;
}
.task-item.completed span {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* --- TAB 2: STRATEGY TECH-TREE MAP --- */
.tech-tree-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 10px 0;
}

.tree-phase-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.phase-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--color-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 5px;
    letter-spacing: 1px;
}

.node-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 15px;
}

.tree-node {
    padding: 15px;
    border-left: 4px solid var(--text-muted);
    background: var(--bg-card);
}
.tree-node.completed {
    border-left-color: var(--color-success);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.05);
}
.tree-node.active {
    border-left-color: var(--color-primary);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.1);
    animation: pulseGlow 2s infinite alternate;
}
.tree-node.locked {
    border-left-color: var(--text-muted);
    opacity: 0.55;
}

@keyframes pulseGlow {
    from { border-left-color: var(--color-primary); }
    to { border-left-color: var(--color-purple); }
}

.node-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.node-status-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
}
.node-status-tag.completed { background-color: rgba(34, 197, 94, 0.15); color: var(--color-success); }
.node-status-tag.active { background-color: rgba(6, 182, 212, 0.15); color: var(--color-primary); }
.node-status-tag.locked { background-color: rgba(255, 255, 255, 0.05); color: var(--text-secondary); }

.node-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* --- TAB 3: UNDERWRITING SANDBOX --- */
.underwriter-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
}
@media (max-width: 768px) {
    .underwriter-grid { grid-template-columns: 1fr; }
}

.calc-sliders {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
}

.slider-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.slider-value {
    color: var(--color-primary);
    font-family: var(--font-heading);
}

input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--color-primary);
    box-shadow: var(--glow-primary);
    cursor: pointer;
    transition: transform 0.1s ease;
}
input[type="range"]::-webkit-slider-thumb:active {
    transform: scale(1.3);
}

.calc-metrics {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: rgba(13, 17, 28, 0.9);
    border: 1px solid var(--color-primary);
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.05);
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 12px;
}
.metric-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
}
.metric-value.net-profit {
    color: var(--color-success);
    font-size: 1.6rem;
}

/* --- TAB 4: DEALS PIPELINE & GALLERY --- */
.sub-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.sub-tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 6px 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.sub-tab-btn.active {
    color: var(--color-primary);
    border-bottom: 2px solid var(--color-primary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.gallery-item {
    cursor: pointer;
    overflow: hidden;
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px;
}

.gallery-img-placeholder {
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-glass);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    color: var(--text-muted);
    border-radius: 8px;
    margin-bottom: 8px;
}

.gallery-label {
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
}

.deals-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.deal-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.deal-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.deal-score {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* --- TAB 5: AGENT CONSOLE OVERSIGHT --- */
.console-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}
@media (max-width: 768px) {
    .console-grid { grid-template-columns: 1fr; }
}

.permission-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.request-card {
    border: 1px solid var(--color-warning);
    background: rgba(249, 115, 22, 0.05);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.request-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--color-warning);
    font-weight: 700;
}

.request-actions {
    display: flex;
    gap: 10px;
}

.btn {
    height: var(--touch-target);
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 16px;
    transition: var(--transition-smooth);
}
.btn-approve { background-color: var(--color-success); color: #fff; }
.btn-deny { background-color: var(--color-danger); color: #fff; }
.btn-primary { background-color: var(--color-primary); color: #040508; font-weight: 700; }
.btn:active { transform: scale(0.96); }

.log-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.console-log {
    background: #010204;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    height: 350px;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: #39ff14; /* Neon Green terminal text */
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* --- TAB 6: MAP EXPANSION --- */
.map-visualizer {
    width: 100%;
    height: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}

.map-placeholder-graphic {
    width: 100%;
    height: 100%;
    opacity: 0.15;
    background-image: radial-gradient(var(--border-color) 2px, transparent 0);
    background-size: 20px 20px;
}

.map-node {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate(-50%, -50%);
    cursor: pointer;
}

.map-node-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid #fff;
    background-color: var(--color-danger);
    transition: var(--transition-smooth);
}
.map-node.active .map-node-dot {
    background-color: var(--color-success);
    box-shadow: var(--glow-success);
}
.map-node.pending .map-node-dot {
    background-color: var(--color-warning);
    box-shadow: var(--glow-warning);
}

.map-node-label {
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 5px;
    background: rgba(4, 5, 8, 0.8);
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

/* --- TAB 7: COLLABORATION FEED & DISPATCH --- */
.feed-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 5px;
}

.feed-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
}
.feed-item.agent {
    border-color: rgba(168, 85, 247, 0.2);
    background: rgba(168, 85, 247, 0.03);
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
}
.feed-author { color: var(--color-primary); }
.feed-item.agent .feed-author { color: var(--color-purple); }
.feed-time { color: var(--text-muted); }

.feed-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.dispatch-input-area {
    display: flex;
    gap: 10px;
}

.input-text {
    flex: 1;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 0 15px;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}
.input-text:focus {
    border-color: var(--color-primary);
    outline: none;
}

/* --- BOTTOM MOBILE NAVIGATION BAR --- */
nav {
    background-color: rgba(13, 17, 28, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.7rem;
    font-weight: 600;
    gap: 4px;
    transition: var(--transition-smooth);
}
.nav-item:active {
    transform: scale(0.92);
}
.nav-item.active {
    color: var(--color-primary);
}

.nav-icon {
    font-size: 1.25rem;
    line-height: 1;
}

/* Submissions view styling */
.submissions-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.submission-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
}
.sub-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}
.sub-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.sub-val {
    font-size: 0.8rem;
    font-weight: 600;
}
.sub-data-block {
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 120px;
    overflow-y: auto;
}
