/* Global Styles */
:root {
    --primary-color: #4ecdc4;
    --secondary-color: #45b7d1;
    --success-color: #96ceb4;
    --warning-color: #feca57;
    --danger-color: #ff6b6b;
    --dark-color: #2d3436;
    --light-color: #dfe6e9;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #2d3436;
    --text-muted: #636e72;
    --border-color: #e1e8ed;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 0;
    box-shadow: var(--shadow);
}

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

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo i {
    font-size: 2rem;
}

.nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Main Content */
.main {
    padding: 2rem 0;
    min-height: calc(100vh - 80px);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.page-header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-card:nth-child(1) .stat-icon { background: var(--primary-color); }
.stat-card:nth-child(2) .stat-icon { background: var(--secondary-color); }
.stat-card:nth-child(3) .stat-icon { background: var(--success-color); }
.stat-card:nth-child(4) .stat-icon { background: var(--warning-color); }

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Charts */
.dashboard-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.chart-section {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.chart-section h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.chart-container {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Recent Sessions */
.recent-sessions {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-top: 2rem;
}

.recent-sessions h3 {
    margin-bottom: 1rem;
    color: var(--dark-color);
}

/* Sessions Controls */
.sessions-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1rem 0;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    box-shadow: var(--shadow);
}

.search-box i {
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.search-box input {
    flex: 1;
    border: none;
    padding: 0.5rem;
    font-size: 1rem;
    outline: none;
}

.search-box button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 0.5rem;
}

.filter-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-controls select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-background);
    font-size: 0.9rem;
}

/* Tables */
.sessions-table,
.uploads-table {
    background: var(--card-background);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

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

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--background-color);
    font-weight: 600;
    color: var(--dark-color);
}

.table tbody tr:hover {
    background: var(--background-color);
}

.table .status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status.completed { background: var(--success-color); color: white; }
.status.processing { background: var(--warning-color); color: white; }
.status.pending { background: var(--light-color); color: var(--text-color); }
.status.failed { background: var(--danger-color); color: white; }

.intent-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: capitalize;
}

.intent-debug { background: #ff6b6b; color: white; }
.intent-create { background: #4ecdc4; color: white; }
.intent-modify { background: #45b7d1; color: white; }
.intent-ask { background: #96ceb4; color: white; }
.intent-review { background: #feca57; color: var(--dark-color); }
.intent-deploy { background: #48dbfb; color: white; }
.intent-test { background: #ff9ff3; color: white; }
.intent-other { background: #dfe6e9; color: var(--text-color); }

.frustration-level {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.frustration-bar {
    width: 50px;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.frustration-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success-color), var(--warning-color), var(--danger-color));
    transition: width 0.3s ease;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--card-background);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination button:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Upload Section */
.upload-section {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.upload-area {
    background: var(--card-background);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(78, 205, 196, 0.05);
}

.upload-content h3 {
    margin: 1rem 0;
    color: var(--dark-color);
}

.upload-content p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.upload-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #3db8af;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

/* Upload Progress */
.upload-progress {
    background: var(--card-background);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.progress-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.progress-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--background-color);
    border-radius: 8px;
}

.progress-info {
    flex: 1;
}

.progress-filename {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.progress-status {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

/* Progress Status Styles */
.progress-item.status-uploading .progress-fill {
    background: var(--primary-color);
}

.progress-item.status-processing .progress-fill {
    background: var(--warning-color);
}

.progress-item.status-completed .progress-fill {
    background: var(--success-color);
}

.progress-item.status-completed .progress-status {
    color: var(--success-color);
    font-weight: 600;
}

.progress-item.status-failed .progress-fill {
    background: var(--danger-color);
}

.progress-item.status-failed .progress-status {
    color: var(--danger-color);
    font-weight: 600;
}

.progress-item.status-pending .progress-fill {
    background: var(--text-muted);
}

/* Airia Integration Styles */
.airia-section {
    margin: 2rem 0;
}

.airia-card {
    background: var(--card-background);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 2px solid #e3f2fd;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
}

.airia-header {
    margin-bottom: 1rem;
}

.airia-header h3 {
    color: #1976d2;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.airia-header p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.9rem;
}

.airia-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

.airia-trigger-btn {
    background: linear-gradient(135deg, #1976d2, #2196f3);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.airia-trigger-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.airia-trigger-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.airia-status {
    width: 100%;
}

.airia-status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    animation: fadeIn 0.3s ease;
}

.airia-status-item.status-success {
    background: #e8f5e8;
    color: #2e7d32;
}

.airia-status-item.status-error {
    background: #ffebee;
    color: #c62828;
}

.airia-status-item.status-loading {
    background: #e3f2fd;
    color: #1976d2;
}

.airia-status-item.status-info {
    background: #f5f5f5;
    color: #616161;
}

/* Airia Modal */
.airia-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.airia-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
}

.airia-modal-header {
    background: linear-gradient(135deg, #1976d2, #2196f3);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.airia-modal-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.airia-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.3s ease;
}

.airia-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.airia-modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.airia-response {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid #1976d2;
}

.airia-response pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

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

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-background);
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--dark-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 6px;
    transition: background-color 0.3s ease;
}

.close-btn:hover {
    background: var(--background-color);
}

.modal-body {
    padding: 1.5rem;
}

/* Loading State */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-charts {
        grid-template-columns: 1fr;
    }

    .sessions-controls {
        flex-direction: column;
    }

    .filter-controls {
        flex-direction: column;
    }

    .search-box {
        flex-direction: column;
        gap: 0.5rem;
    }

    .search-box input {
        margin: 0.5rem 0;
    }

    .table {
        font-size: 0.9rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .upload-area {
        padding: 2rem 1rem;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }