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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
}

header {
    color: white;
    margin-bottom: 40px;
}

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

.header-content > div {
    text-align: center;
    flex: 1;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(20deg) scale(1.1);
}

.theme-icon {
    font-size: 1.5rem;
}

main {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.upload-section {
    text-align: center;
}

.upload-area {
    border: 3px dashed #667eea;
    border-radius: 15px;
    padding: 60px 40px;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #f8f9ff;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
}

.upload-area.drag-over {
    border-color: #764ba2;
    background: #e8ebff;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-area h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3rem;
}

.upload-area p {
    color: #666;
    margin-bottom: 20px;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    background: #f8f9ff;
    border-radius: 10px;
    margin-top: 20px;
}

.file-details {
    display: flex;
    align-items: center;
    gap: 15px;
}

.file-icon {
    font-size: 2.5rem;
}

.file-details strong {
    display: block;
    color: #333;
    font-size: 1.1rem;
}

.file-details p {
    color: #666;
    font-size: 0.9rem;
    margin-top: 5px;
}

button {
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-success {
    background: #10b981;
    color: white;
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    font-size: 1.1rem;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-2px);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    width: 100%;
    margin-top: 15px;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-download {
    background: #3b82f6;
    color: white;
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
}

.btn-download:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.progress-section {
    margin-top: 30px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

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

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

#progressText {
    text-align: center;
    color: #667eea;
    font-weight: 600;
}

.result-section {
    margin-top: 30px;
}

.result-card {
    padding: 40px;
    border-radius: 15px;
    text-align: center;
}

.result-card.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.result-card.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.result-card h3 {
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

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

.stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.1);
    padding: 5px;
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: none;
}

.tab-btn.active {
    background: white;
    color: #10b981;
}

.tab-content {
    display: none;
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    color: #333;
}

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

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.preview-header h4 {
    color: #333;
    font-size: 1.1rem;
    margin: 0;
}

.btn-copy {
    background: #6366f1;
    color: white;
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-copy:hover {
    background: #4f46e5;
}

/* Text preview */
.text-preview {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #374151;
}

/* Entities */
.entities-list {
    max-height: 400px;
    overflow-y: auto;
}

.entity-group {
    margin-bottom: 20px;
}

.entity-group h5 {
    color: #6366f1;
    font-size: 1rem;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f0f1ff;
    border-radius: 6px;
}

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

.entity-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.entity-text {
    color: #374151;
    font-weight: 500;
}

.entity-confidence {
    color: #10b981;
    font-size: 0.85rem;
    font-weight: 600;
}

.no-data {
    text-align: center;
    color: #9ca3af;
    padding: 40px;
    font-size: 1rem;
}

/* JSON preview */
.json-preview {
    background: #1f2937;
    color: #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* Action buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

footer {
    text-align: center;
    color: white;
    margin-top: 30px;
    opacity: 0.8;
}

/* Dark mode */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body.dark-mode main {
    background: #1f2937;
    color: #e5e7eb;
}

body.dark-mode .upload-area {
    background: #111827;
    border-color: #4f46e5;
    color: #e5e7eb;
}

body.dark-mode .upload-area:hover {
    background: #1f2937;
    border-color: #6366f1;
}

body.dark-mode .upload-area h3 {
    color: #e5e7eb;
}

body.dark-mode .upload-area p {
    color: #9ca3af;
}

body.dark-mode .file-info {
    background: #111827;
}

body.dark-mode .file-details strong {
    color: #e5e7eb;
}

body.dark-mode .file-details p {
    color: #9ca3af;
}

body.dark-mode .tab-content {
    background: #111827;
    color: #e5e7eb;
}

body.dark-mode .preview-header {
    border-bottom-color: #374151;
}

body.dark-mode .preview-header h4 {
    color: #e5e7eb;
}

body.dark-mode .text-preview {
    background: #0f1419;
    border-color: #374151;
    color: #d1d5db;
}

body.dark-mode .entity-group h5 {
    background: #1e293b;
    color: #818cf8;
}

body.dark-mode .entity-item {
    background: #0f1419;
    border-color: #374151;
}

body.dark-mode .entity-text {
    color: #d1d5db;
}

body.dark-mode #progressText {
    color: #818cf8;
}

/* Scrollbar styling */
.text-preview::-webkit-scrollbar,
.entities-list::-webkit-scrollbar,
.json-preview::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.text-preview::-webkit-scrollbar-track,
.entities-list::-webkit-scrollbar-track,
.json-preview::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.text-preview::-webkit-scrollbar-thumb,
.entities-list::-webkit-scrollbar-thumb,
.json-preview::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.text-preview::-webkit-scrollbar-thumb:hover,
.entities-list::-webkit-scrollbar-thumb:hover,
.json-preview::-webkit-scrollbar-thumb:hover {
    background: #555;
}

body.dark-mode .text-preview::-webkit-scrollbar-track,
body.dark-mode .entities-list::-webkit-scrollbar-track {
    background: #1f2937;
}

body.dark-mode .text-preview::-webkit-scrollbar-thumb,
body.dark-mode .entities-list::-webkit-scrollbar-thumb {
    background: #4b5563;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    header h1 {
        font-size: 2rem;
    }

    main {
        padding: 30px 20px;
    }

    .upload-area {
        padding: 40px 20px;
    }

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

    .tabs {
        flex-direction: column;
        gap: 5px;
    }

    .tab-btn {
        font-size: 0.9rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }
}

/* Webhook Section Styles */
.webhook-section {
    margin-top: 30px;
}

.webhook-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.webhook-card h3 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.webhook-card > p {
    color: #666;
    margin-bottom: 25px;
}

.webhook-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: #333;
    font-weight: 600;
    font-size: 0.95rem;
}

.webhook-input {
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 100%;
}

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

.file-upload-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-name-display {
    color: #666;
    font-size: 0.9rem;
    flex: 1;
}

.json-preview-small {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px;
    max-height: 200px;
    overflow: auto;
    font-size: 0.85rem;
    color: #333;
}

.btn-send-webhook {
    margin-top: 10px;
    width: 100%;
}

.btn-send-webhook:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.webhook-result {
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    animation: slideIn 0.3s ease;
}

.webhook-result.success {
    background: #e8f5e9;
    border: 1px solid #4caf50;
}

.webhook-result.error {
    background: #ffebee;
    border: 1px solid #f44336;
}

.result-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-icon {
    font-size: 1.2rem;
}

.result-message {
    color: #333;
    font-size: 0.95rem;
}

/* Dark mode webhook styles */
body.dark-mode .webhook-card {
    background: #2d3748;
}

body.dark-mode .webhook-card h3 {
    color: #e2e8f0;
}

body.dark-mode .webhook-card > p {
    color: #a0aec0;
}

body.dark-mode .form-group label {
    color: #e2e8f0;
}

body.dark-mode .webhook-input {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .webhook-input:focus {
    border-color: #667eea;
}

body.dark-mode .file-name-display {
    color: #a0aec0;
}

body.dark-mode .json-preview-small {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .result-message {
    color: #e2e8f0;
}

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

/* Webhook hint styles */
.webhook-hint {
    margin-top: 8px;
    padding: 12px;
    background: #f0f7ff;
    border-left: 3px solid #667eea;
    border-radius: 6px;
    display: flex;
    gap: 10px;
    font-size: 0.9rem;
}

.hint-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.hint-content {
    color: #555;
    line-height: 1.6;
}

.hint-content strong {
    color: #333;
}

.hint-content code {
    background: #e3e8ef;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #667eea;
}

/* Dark mode webhook hint */
body.dark-mode .webhook-hint {
    background: #1a2332;
    border-left-color: #667eea;
}

body.dark-mode .hint-content {
    color: #a0aec0;
}

body.dark-mode .hint-content strong {
    color: #e2e8f0;
}

body.dark-mode .hint-content code {
    background: #2d3748;
    color: #81a1c1;
}

/* Multiple Webhooks Styles */
.webhook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.webhook-header label {
    margin: 0;
}

.btn-add-webhook {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.btn-add-webhook:hover {
    background: #5568d3;
}

.btn-add-webhook:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.webhook-urls-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 15px;
}

.webhook-url-item {
    display: flex;
    gap: 10px;
    align-items: center;
    animation: slideIn 0.2s ease;
}

.webhook-url-item input {
    flex: 1;
}

.webhook-url-item .webhook-number {
    background: #667eea;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.btn-remove-webhook {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.btn-remove-webhook:hover {
    background: #d32f2f;
}

.webhook-status-list {
    margin-top: 15px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.webhook-status-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #ccc;
}

.webhook-status-item.success {
    border-left-color: #4caf50;
}

.webhook-status-item.error {
    border-left-color: #f44336;
}

.webhook-status-item.pending {
    border-left-color: #ff9800;
}

.webhook-status-icon {
    font-size: 1.2rem;
}

.webhook-status-url {
    flex: 1;
    font-size: 0.85rem;
    color: #666;
    word-break: break-all;
}

.webhook-status-message {
    font-size: 0.85rem;
    color: #333;
}

/* Dark mode webhook list */
body.dark-mode .btn-add-webhook {
    background: #667eea;
}

body.dark-mode .btn-add-webhook:hover {
    background: #5568d3;
}

body.dark-mode .webhook-status-list {
    background: #1a202c;
}

body.dark-mode .webhook-status-item {
    background: #2d3748;
}

body.dark-mode .webhook-status-url {
    color: #a0aec0;
}

body.dark-mode .webhook-status-message {
    color: #e2e8f0;
}
