/* CSS Variables */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-dark: #1e293b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

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

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

/* App Container */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.header-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

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

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

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--bg-dark);
}

.tagline {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

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

.attribution a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.attribution a:hover {
    text-decoration: underline;
}

/* Status Panel */
.status-panel {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.status-card {
    flex: 1;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--warning-color);
    animation: pulse 2s infinite;
}

.status-dot.loaded {
    background: var(--success-color);
    animation: none;
}

.status-dot.error {
    background: var(--danger-color);
    animation: none;
}

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

.status-text {
    font-weight: 500;
    color: var(--text-primary);
}

.progress-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

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

.progress-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-width: 45px;
}

.model-info {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

.info-value {
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 5px;
}

/* Input Section */
.input-section {
    margin-bottom: 20px;
}

.input-card {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.input-card h2 {
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Tabs */
.input-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.tab-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

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

.tab-content {
    display: none;
}

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

/* Text Input */
textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition);
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

/* File Upload */
.file-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 50px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.file-upload-area p {
    color: var(--text-primary);
    margin: 5px 0;
}

.upload-hint {
    color: var(--text-secondary) !important;
    font-size: 0.9rem;
}

.file-types {
    color: var(--text-secondary) !important;
    font-size: 0.8rem !important;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-top: 15px;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

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

/* Log Presets */
.log-presets {
    margin-bottom: 15px;
}

.log-presets h4 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.preset-btn {
    padding: 8px 16px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

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

/* Options Section */
.options-section {
    margin-bottom: 20px;
}

.options-card {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.options-card h2 {
    margin-bottom: 20px;
}

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

.option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.option-item:hover {
    background: var(--border-color);
}

.option-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.option-label {
    font-weight: 500;
    color: var(--text-primary);
}

.option-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: auto;
}

/* Results Section */
.results-section {
    margin-bottom: 20px;
}

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

.results-header h2 {
    color: var(--text-primary);
}

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

/* Risk Assessment */
.risk-assessment {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.risk-assessment h3 {
    margin-bottom: 15px;
}

.risk-meter {
    display: flex;
    align-items: center;
    gap: 20px;
}

.risk-label {
    font-weight: 500;
}

.risk-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.risk-value {
    font-weight: 700;
    font-size: 1.2rem;
    min-width: 100px;
}

.risk-value.low { color: var(--success-color); }
.risk-value.medium { color: var(--warning-color); }
.risk-value.high { color: var(--danger-color); }

.risk-bar-container {
    flex: 1;
    height: 12px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.risk-bar {
    height: 100%;
    width: 0%;
    transition: width 0.5s ease, background-color 0.3s ease;
    border-radius: 6px;
}

.risk-bar.low { background: var(--success-color); }
.risk-bar.medium { background: var(--warning-color); }
.risk-bar.high { background: var(--danger-color); }

/* Results Tabs */
.results-tabs {
    display: flex;
    gap: 5px;
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: 2px solid var(--border-color);
}

.result-tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.result-tab:hover {
    background: var(--bg-primary);
}

.result-tab.active {
    background: var(--primary-color);
    color: white;
}

/* Results Content */
.results-content {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-md);
}

.result-panel {
    display: none;
}

.result-panel.active {
    display: block;
}

/* Entity Category */
.entity-category {
    margin-bottom: 25px;
}

.entity-category h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.entity-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.entity-tag {
    padding: 8px 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.entity-tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.entity-tag.suspicious {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.entity-tag.malicious {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* Classification Results */
.classification-results {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.classification-item {
    padding: 15px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary-color);
}

.classification-item.high-risk {
    border-left-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.05);
}

.classification-item.medium-risk {
    border-left-color: var(--warning-color);
    background: rgba(245, 158, 11, 0.05);
}

.classification-category {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.classification-confidence {
    display: flex;
    align-items: center;
    gap: 10px;
}

.confidence-bar {
    flex: 1;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 3px;
}

.confidence-value {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 50px;
}

/* IOC Section */
.ioc-section {
    margin-bottom: 25px;
}

.ioc-section h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
}

.ioc-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ioc-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--border-color);
}

.ioc-item.high {
    border-left-color: var(--danger-color);
}

.ioc-item.medium {
    border-left-color: var(--warning-color);
}

.ioc-item.low {
    border-left-color: var(--success-color);
}

.ioc-type {
    padding: 4px 10px;
    background: var(--bg-dark);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 80px;
    text-align: center;
}

.ioc-value {
    flex: 1;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

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

/* Summary */
.summary-content {
    line-height: 1.8;
    color: var(--text-primary);
}

.summary-content h4 {
    margin-top: 20px;
    margin-bottom: 10px;
}

.summary-content ul {
    margin-left: 20px;
}

/* Raw Data */
.raw-data {
    background: var(--bg-dark);
    color: #e2e8f0;
    padding: 20px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
}

/* History Section */
.history-section {
    margin-bottom: 20px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-header h2 {
    color: var(--text-primary);
}

.history-list {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    max-height: 300px;
    overflow-y: auto;
}

.empty-history {
    color: var(--text-secondary);
    text-align: center;
    padding: 30px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    background: var(--border-color);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.history-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.history-type {
    font-weight: 500;
}

.history-risk {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
}

.history-risk.low {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.history-risk.medium {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.history-risk.high {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

/* Footer */
.footer {
    text-align: center;
    padding: 25px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.disclaimer {
    margin-top: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loadingText {
    color: white;
    font-size: 1.1rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1001;
}

.toast {
    padding: 15px 20px;
    background: var(--bg-dark);
    color: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

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

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .status-panel {
        flex-direction: column;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .risk-meter {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .input-tabs {
        flex-wrap: wrap;
    }
    
    .results-header {
        flex-direction: column;
        gap: 15px;
    }
}