/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.logo-icon {
    font-size: 2em;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.logo-text {
    font-size: 1.1em;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: rgba(255, 255, 255, 0.3);
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    border-left-color: #60a5fa;
    box-shadow: inset 0 0 20px rgba(96, 165, 250, 0.2);
}

.nav-icon {
    font-size: 1.2em;
    width: 24px;
    text-align: center;
}

.nav-text {
    font-weight: 500;
    font-size: 0.95em;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
}

.main-header {
    background: white;
    padding: 25px 30px;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.main-header h1 {
    color: #1e40af;
    font-size: 1.8em;
    margin-bottom: 8px;
    font-weight: 600;
}

.main-header p {
    color: #6b7280;
    font-size: 1em;
}

/* Tab Content Styles */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease-in;
}

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

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

/* Card Styles */
.card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.card h2 {
    color: #1e40af;
    font-size: 1.4em;
    margin-bottom: 20px;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 0.95em;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95em;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    box-shadow: 0 4px 14px rgba(107, 114, 128, 0.3);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #4b5563, #374151);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.button-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Result Styles */
.result {
    margin-top: 20px;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid transparent;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.5;
}

.result.loading {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-color: #f59e0b;
    color: #92400e;
}

.result.success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    border-color: #10b981;
    color: #065f46;
}

.result.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border-color: #ef4444;
    color: #991b1b;
}

/* Stats Styles */
.stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 15px 0;
}

.stat-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    color: #374151;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Dataset Analysis Styles */
.dataset-files {
    margin-top: 15px;
}

.file-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
}

.file-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-name {
    font-weight: 500;
    color: #333;
}

.file-status.exists {
    color: #28a745;
    font-weight: 500;
}

.file-status.missing {
    color: #dc3545;
    font-weight: 500;
}

/* Dataset Dashboard Styles */
.dataset-dashboard {
    margin-bottom: 30px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    border: 1px solid #e9ecef;
    animation: slideDown 0.5s ease-out;
}

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

.dashboard-header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 25px;
    position: relative;
}

.dashboard-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.dashboard-title h3 {
    margin: 0;
    font-size: 1.8em;
    font-weight: 600;
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.2);
}

.stat-number {
    font-size: 2.2em;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.95;
    font-weight: 500;
}

.dashboard-content {
    padding: 30px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
}

.dashboard-content .dashboard-section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.dashboard-content .dashboard-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.dashboard-content h4 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 1.2em;
    font-weight: 600;
    padding-bottom: 10px;
    border-bottom: 3px solid #3b82f6;
    display: flex;
    align-items: center;
    gap: 8px;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.metric-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.metric-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.metric-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #3b82f6;
    margin-bottom: 5px;
}

.metric-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

/* Enhanced Chart Containers */
.chart-container {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 25px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chart-container:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

/* Enhanced Bar Charts */
.bar-chart {
    width: 100%;
    height: 220px;
    display: flex;
    align-items: end;
    gap: 15px;
    padding: 20px 0;
    justify-content: center;
}

.bar {
    flex: 1;
    max-width: 120px;
    background: linear-gradient(to top, #3b82f6, #1d4ed8);
    border-radius: 8px 8px 0 0;
    position: relative;
    min-height: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.bar:hover {
    background: linear-gradient(to top, #2563eb, #1e40af);
    transform: scaleY(1.05);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.bar-value {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bar-label {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

/* Enhanced Sentiment Bars */
.sentiment-bars {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: end;
    height: 180px;
    margin-top: 20px;
}

.sentiment-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.sentiment-bar:hover {
    transform: scale(1.05);
}

.sentiment-bar .bar {
    width: 80px;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.sentiment-bar.positive .bar {
    background: linear-gradient(to top, #10b981, #059669);
}

.sentiment-bar.neutral .bar {
    background: linear-gradient(to top, #f59e0b, #d97706);
}

.sentiment-bar.negative .bar {
    background: linear-gradient(to top, #ef4444, #dc2626);
}

.sentiment-value {
    font-size: 1.4em;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sentiment-label {
    font-weight: 600;
    color: #333;
    font-size: 1em;
}

/* Enhanced Topics List */
.topics-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.topic-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.topic-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

.topic-name {
    font-weight: 500;
    color: #333;
    flex: 1;
}

.topic-count {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        overflow-x: auto;
    }
    
    .sidebar-nav {
        display: flex;
        padding: 10px 0;
    }
    
    .nav-item {
        flex-shrink: 0;
        padding: 10px 15px;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .nav-item.active {
        border-left: none;
        border-bottom-color: #60a5fa;
    }
    
    .main-content {
        overflow: visible;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

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

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px;
}
