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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    color: #6b7280;
    font-weight: 400;
    margin-bottom: 1rem;
}

.instructions {
    background: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    margin-top: 1rem;
}

.instructions p {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

.instructions p:last-child {
    margin-bottom: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    grid-template-areas:
        "input output"
        "stats stats"
        "log log";
}

/* Input Section */
.input-section {
    grid-area: input;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    height: fit-content;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.prompt-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.prompt-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-label {
    font-weight: 500;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-input {
    padding: 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    width: 80px;
    font-size: 1rem;
}

.checkbox {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

/* Model Status */
.model-status {
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    margin-bottom: 1.5rem;
}

.model-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.model-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.model-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.model-name {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.model-size {
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 400;
}

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

.status-badge.mock {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fed7aa;
}

.status-badge.loading {
    background: #dbeafe;
    color: #2563eb;
    border: 1px solid #bfdbfe;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-badge.loaded {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.status-badge.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

/* Buttons */
.button-group {
    display: flex;
    gap: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-accent {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-accent:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Spinner */
.btn-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

/* Output Section */
.output-section {
    grid-area: output;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    height: fit-content;
}

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

.output-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.progress-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 0.875rem;
    color: #6b7280;
}

.output-area {
    min-height: 200px;
    padding: 1.5rem;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    overflow-wrap: break-word;
}

.placeholder-text {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    margin-top: 4rem;
}

/* Token Styles */
.token {
    display: inline-block;
    padding: 2px 4px;
    margin: 1px;
    border-radius: 4px;
    transition: all 0.3s ease;
    animation: tokenAppear 0.5s ease-out;
}

@keyframes tokenAppear {
    0% {
        opacity: 0;
        transform: translateY(-10px) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.token.accepted {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.token.rejected {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
    text-decoration: line-through;
}

.token.pending {
    background-color: #fef3c7;
    color: #d97706;
    border: 1px solid #fed7aa;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* Legend */
.legend {
    background: #f8fafc;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.legend h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.token-example {
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
}

.legend-text {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Statistics Section */
.stats-section {
    grid-area: stats;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.stats-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* Log Section */
.log-section {
    grid-area: log;
    background: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

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

.log-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1f2937;
}

.log-area {
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: #1f2937;
    color: #f9fafb;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

.log-placeholder {
    color: #9ca3af;
    font-style: italic;
    text-align: center;
    margin-top: 2rem;
}

.log-entry {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.log-entry.draft {
    color: #fbbf24;
}

.log-entry.verify {
    color: #34d399;
}

.log-entry.reject {
    color: #f87171;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.footer a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
}

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

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

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

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

.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.loading-subtext {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
}

.loading-progress {
    margin-top: 2rem;
    width: 300px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-details {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        grid-template-areas:
            "input"
            "output"
            "stats"
            "log";
    }

    .title {
        font-size: 2rem;
    }

    .controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .button-group {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .output-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .progress-info {
        align-items: flex-start;
    }
}