/* ============================================================================
   GENOMA.IA Manager - Shared Stylesheet
   Used by: config.html, analytics.html
   ============================================================================ */

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

body { 
    font-family: 'Monaco', 'Courier New', monospace; 
    background: #0a0a0a; 
    color: #e0e0e0; 
    padding: 20px;
    overflow-x: hidden;
}

.container { 
    max-width: 1600px; 
    margin: 0 auto; 
}

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

.header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #333;
}

.header h1 { 
    font-size: 24px; 
    color: #4caf50; 
}

.header-info {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.header-controls { 
    display: flex; 
    gap: 10px; 
    align-items: center; 
}

.stats { 
    display: flex; 
    gap: 20px; 
    font-size: 13px; 
    color: #888; 
}

.stat { 
    display: flex; 
    flex-direction: column; 
}

.stat-label { 
    color: #666; 
    font-size: 11px; 
}

.stat-value { 
    color: #4caf50; 
    font-size: 14px; 
    font-weight: bold; 
}

/* ============================================================================
   Actions & Buttons
   ============================================================================ */

.actions { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 20px; 
}

button {
    padding: 10px 20px;
    background: #333;
    color: white;
    border: 1px solid #555;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    border-radius: 3px;
    transition: all 0.2s;
}

button:hover { 
    background: #444; 
    border-color: #777; 
}

button.primary { 
    background: #4caf50; 
    border-color: #4caf50; 
}

button.primary:hover { 
    background: #45a049; 
}

button.small {
    padding: 6px 12px;
    font-size: 11px;
}

button.export-btn {
    background: #2196f3;
    border-color: #2196f3;
}

button.export-btn:hover {
    background: #1976d2;
}

/* ============================================================================
   Editor Sections
   ============================================================================ */

.editor {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.editor h2 {
    font-size: 16px;
    color: #4caf50;
    margin-bottom: 15px;
    font-weight: normal;
    border-bottom: 1px solid #333;
    padding-bottom: 8px;
}

/* ============================================================================
   Forms
   ============================================================================ */

input[type="text"], 
input[type="number"], 
input[type="date"],
select, 
textarea {
    width: 100%;
    padding: 8px;
    background: #0d0d0d;
    color: #e0e0e0;
    border: 1px solid #333;
    font-family: inherit;
    font-size: 13px;
    border-radius: 3px;
}

textarea { 
    resize: vertical; 
}

input:focus, 
select:focus, 
textarea:focus { 
    outline: none; 
    border-color: #4caf50; 
}

label {
    display: block;
    font-size: 11px;
    color: #666;
    margin-bottom: 5px;
    margin-top: 10px;
    text-transform: uppercase;
}

label:first-child { 
    margin-top: 0; 
}

.field-group { 
    margin-bottom: 12px; 
}

.hint { 
    font-size: 11px; 
    color: #666; 
    margin-top: 3px; 
}

/* ============================================================================
   Grid Layouts
   ============================================================================ */

.grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* ============================================================================
   KPI Cards
   ============================================================================ */

.kpi-card {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 20px;
    border-radius: 4px;
}

.kpi-label {
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    color: #4caf50;
    font-weight: bold;
}

.kpi-subtitle {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

/* ============================================================================
   Charts
   ============================================================================ */

.chart-container {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 20px;
    border-radius: 4px;
    height: 300px;
}

.chart-container h3 {
    font-size: 14px;
    color: #4caf50;
    margin-bottom: 15px;
    font-weight: normal;
}

.chart-wrapper {
    position: relative;
    height: calc(100% - 35px);
}

/* ============================================================================
   Filters
   ============================================================================ */

.filters {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    border-radius: 4px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    margin: 0;
}

.filter-group input, 
.filter-group select {
    padding: 6px 10px;
    font-size: 12px;
}

/* ============================================================================
   Tables
   ============================================================================ */

.table-container {
    background: #1a1a1a;
    border: 1px solid #333;
    margin-bottom: 20px;
    border-radius: 4px;
    overflow: hidden;
}

.table-header {
    padding: 15px 20px;
    border-bottom: 1px solid #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 16px;
    color: #4caf50;
    font-weight: normal;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 20px;
    text-align: left;
    border-bottom: 1px solid #222;
    font-size: 13px;
}

th {
    background: #151515;
    color: #888;
    font-weight: normal;
    font-size: 11px;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background: #1a1a1a;
    color: #4caf50;
}

th.sorted {
    color: #4caf50;
}

tr:hover td {
    background: #1d1d1d;
}

.cost-cell {
    color: #4caf50;
    font-weight: bold;
}

.cache-cell {
    color: #2196f3;
}

.anomaly-cell {
    color: #ff9800;
}

/* ============================================================================
   Detail Panel (Expandable)
   ============================================================================ */

.detail-panel {
    background: #1a1a1a;
    border: 1px solid #333;
    margin-top: 10px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.detail-panel.open {
    max-height: 1000px;
    padding: 20px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.detail-section {
    background: #0d0d0d;
    padding: 15px;
    border-radius: 4px;
}

.detail-section h4 {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.detail-value {
    font-size: 14px;
    color: #e0e0e0;
    margin: 5px 0;
}

/* ============================================================================
   Turn List (Conversation Display)
   ============================================================================ */

.turn-list {
    margin-top: 15px;
}

.turn-item {
    background: #0d0d0d;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 3px solid #4caf50;
}

.turn-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 11px;
    color: #888;
}

.turn-content {
    font-size: 12px;
    line-height: 1.6;
}

.turn-user { 
    color: #2196f3; 
    margin-bottom: 5px;
}

.turn-assistant { 
    color: #4caf50; 
}

/* ============================================================================
   Notifications
   ============================================================================ */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    background: #4caf50;
    color: white;
    border-radius: 4px;
    display: none;
    animation: slideIn 0.3s;
    z-index: 1000;
}

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

.notification.error { 
    background: #f44336; 
}

/* ============================================================================
   Log Display
   ============================================================================ */

.log {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.8;
    border-radius: 4px;
}

.log-entry { 
    margin-bottom: 5px; 
}

.log-time { 
    color: #666; 
}

.log-msg { 
    color: #e0e0e0; 
}

/* ============================================================================
   Auto-refresh Indicator
   ============================================================================ */

.refresh-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.refresh-indicator.active {
    color: #4caf50;
}

.refresh-dot {
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
}

.refresh-indicator.active .refresh-dot {
    background: #4caf50;
    animation: pulse 2s infinite;
}

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

/* ============================================================================
   Empty States
   ============================================================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.empty-state-text {
    font-size: 15px;
}

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

@media (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}
