/* Global Styles */
:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --border-color: #e2e8f0;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%) !important;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: white !important;
}

.navbar-brand i {
    font-size: 1.5rem;
    color: #fbbf24;
}

#model-status, #generation-status {
    color: rgba(255, 255, 255, 0.9) !important;
    font-size: 0.875rem;
}

#model-status i, #generation-status i {
    font-size: 0.5rem;
    margin-right: 0.5rem;
}

/* Main Container */
.main-container {
    padding-top: 80px;
    height: calc(100vh - 80px);
    background: var(--bg-secondary);
}

/* Panel Layout */
.input-panel, .results-panel {
    height: 100%;
    overflow-y: auto;
}

.input-panel {
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.results-panel {
    background: var(--bg-primary);
}

.panel-content {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Section Titles */
.section-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
}

.section-title i {
    color: var(--primary-color);
}

/* Input Section */
.input-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-control {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    resize: vertical;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-text {
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.form-text i {
    color: var(--primary-color);
}

/* Buttons */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-outline-primary, .btn-outline-secondary {
    border-width: 1px;
}

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

/* Parameters Section */
.parameters-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

.form-range {
    height: 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
}

.form-range::-webkit-slider-thumb {
    background: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-range::-moz-range-thumb {
    background: var(--primary-color);
    border: 2px solid white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.form-range::-webkit-slider-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
    height: 6px;
}

.form-range::-moz-range-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
    height: 6px;
}

/* Statistics Section */
.statistics-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    border: 1px solid var(--border-color);
}

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

.stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Results Panel */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Welcome Message */
.welcome-message {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.welcome-content {
    text-align: center;
    max-width: 500px;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 2rem;
    color: white;
    font-size: 2rem;
}

.welcome-content h3 {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.welcome-text {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.features-preview {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.feature-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.feature-preview i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Generation Results */
.generation-results {
    flex: 1;
    overflow-y: auto;
}

.text-section {
    margin-bottom: 2rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.text-section-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
}

.text-section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 2px;
    margin-right: 0.75rem;
}

.text-display {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Confidence Text Display */
.confidence-text {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.token {
    display: inline-block;
    position: relative;
    margin: 0 1px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.token:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.token.high-confidence {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.token.medium-confidence {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.token.low-confidence {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.token-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--dark-color);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.token:hover .token-tooltip {
    opacity: 1;
}

.token-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: var(--dark-color);
}

/* Token Analysis */
.token-analysis {
    display: grid;
    gap: 1rem;
}

.token-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    transition: all 0.2s ease;
}

.token-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.token-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.token-text {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.token-confidence {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.token-confidence.high {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

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

.token-confidence.low {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.confidence-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.confidence-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.confidence-fill.high {
    background: linear-gradient(90deg, var(--success-color), #34d399);
}

.confidence-fill.medium {
    background: linear-gradient(90deg, var(--warning-color), #fbbf24);
}

.confidence-fill.low {
    background: linear-gradient(90deg, var(--danger-color), #f87171);
}

.alternatives {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.alternative {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.alternative .confidence {
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Loading State */
.loading-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.loading-content {
    text-align: center;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

.progress {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.modal-title {
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* Token Details Modal */
.token-details {
    display: grid;
    gap: 1.5rem;
}

.detail-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.detail-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-item:last-child {
    border-bottom: none;
}

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

.detail-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

.token {
    animation: slideIn 0.3s ease;
}

.token-item {
    animation: fadeInUp 0.3s ease;
}

/* Responsive Design */
@media (max-width: 992px) {
    .input-panel {
        position: fixed;
        left: -100%;
        top: 80px;
        width: 100%;
        z-index: 1000;
        transition: left 0.3s ease;
        height: calc(100vh - 80px);
    }
    
    .input-panel.show {
        left: 0;
    }
    
    .results-panel {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .features-preview {
        flex-direction: column;
        gap: 1rem;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .panel-content {
        padding: 1rem;
        gap: 1.5rem;
    }
    
    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .header-actions {
        justify-content: center;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Utility Classes */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.shadow-custom {
    box-shadow: var(--shadow-lg);
}

/* Status Indicators */
.status-online {
    color: var(--success-color) !important;
}

.status-offline {
    color: var(--danger-color) !important;
}

.status-loading {
    color: var(--warning-color) !important;
    animation: pulse 1.5s infinite;
}

.status-generating {
    color: var(--primary-color) !important;
    animation: pulse 1.5s infinite;
}
