/* Playground Specific Styles */
.playground-interface {
    padding-top: 100px;
    min-height: calc(100vh - 380px);
}

/* Step Container Styles */
.playground-container {
    background-color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.playground-step {
    display: none;
}

.playground-step.active {
    display: block;
}

/* Upload Area Styles */
.upload-container {
    padding: 2rem;
}

.upload-area {
    border: 2px dashed var(--gray-light);
    border-radius: var(--border-radius);
    padding: 3rem 2rem;
    text-align: center;
    transition: var(--transition);
    background-color: rgba(248, 250, 252, 0.6);
}

.upload-area:hover, .upload-area.drag-over {
    border-color: var(--primary);
    background-color: rgba(99, 102, 241, 0.05);
}

.upload-area h3 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.upload-area p {
    color: var(--gray);
    margin-bottom: 1rem;
}

.upload-icon {
    color: var(--primary);
}

.file-restrictions {
    font-size: 0.85rem;
    margin-top: 1.5rem;
    color: var(--gray);
}

/* Processing Container Styles */
.processing-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
}

.document-preview-container {
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-light);
    overflow: hidden;
}

.document-preview-container h3 {
    padding: 1rem;
    margin: 0;
    background-color: var(--light);
    border-bottom: 1px solid var(--gray-light);
}

.document-preview {
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.document-preview img {
    max-width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.document-preview .pdf-container {
    width: 100%;
    height: 100%;
    min-height: 500px;
}

/* Extraction Container Styles */
.extraction-container {
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.extraction-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--light);
    border-bottom: 1px solid var(--gray-light);
}

.extraction-header h3 {
    margin: 0;
}

.entity-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.entity-list {
    padding: 1rem;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 400px;
}

/* Entity item styling with delete button */
.entity-item {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-light);
    align-items: center;
}

.entity-item:last-child {
    border-bottom: none;
}

.entity-name, .entity-value {
    padding: 0.75rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
    width: 100%;
    background-color: var(--light);
}

.entity-name {
    font-weight: 600;
    color: var(--dark);
}

.entity-value {
    color: var(--gray);
}

.entity-value.filled {
    color: var(--dark);
    border-color: var(--primary-light);
    background-color: rgba(248, 250, 252, 0.8);
}

.entity-delete-btn {
    background: none;
    border: 20px;
    color: var(--error);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: var(--transition);
}

.entity-delete-btn:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.extraction-actions {
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    border-top: 1px solid var(--gray-light);
    background-color: var(--light);
}

.extraction-actions .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hidden {
    display: none;
}

/* Raw Results Section */
.raw-results-container {
    margin-top: 1rem;
    background-color: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-light);
    overflow: hidden;
    margin: 0 2rem 2rem 2rem;
}

.raw-results-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--light);
    border-bottom: 1px solid var(--gray-light);
    cursor: pointer;
}

.raw-results-header h3 {
    margin: 0;
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.raw-results-header.active .toggle-icon {
    transform: rotate(180deg);
}

.raw-results-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.raw-results-content.visible {
    max-height: 500px;
    padding: 1rem;
}

#rawOcrResults {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: var(--border-radius);
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 400px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
    justify-content: center;
    align-items: center;
}

.modal.visible {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 700px;
    box-shadow: var(--shadow-lg);
    animation: modalFadeIn 0.3s;
}

.modal-sm {
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-light);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Settings Modal Specific Styles */
.settings-tabs {
    display: flex;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--gray-light);
}

.settings-tab {
    padding: 0.75rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

.settings-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.settings-panel {
    display: none;
}

.settings-panel.active {
    display: block;
}

.settings-group {
    margin-bottom: 2rem;
}

.settings-group:last-child {
    margin-bottom: 0;
}

.settings-group h3 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-size: 0.95rem;
}

.form-group input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    margin: 0;
}

.api-status {
    margin-left: 1rem;
    font-size: 0.9rem;
}

.api-status.success {
    color: var(--success);
}

.api-status.error {
    color: var(--error);
}

.default-entities-list {
    margin-bottom: 1.5rem;
}

.default-entity-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: var(--light);
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
}

.default-entity-name {
    flex-grow: 1;
    font-weight: 500;
}

.default-entity-actions {
    display: flex;
    gap: 0.5rem;
}

.delete-entity-btn {
    background: none;
    border: none;
    color: var(--error);
    cursor: pointer;
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    background-color: var(--dark);
    color: white;
    box-shadow: var(--shadow);
    z-index: 1100;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 350px;
}

.notification.visible {
    transform: translateX(0);
}

.notification.success {
    background-color: var(--success);
}

.notification.error {
    background-color: var(--error);
}

.notification.info {
    background-color: var(--primary);
}

.notification.warning {
    background-color: var(--warning);
}

/* Responsive Adjustments */
@media (max-width: 992px) {
    .processing-container {
        grid-template-columns: 1fr;
    }
    
    .document-preview {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .entity-item {
        grid-template-columns: 1fr auto;
    }
    
    .entity-name {
        grid-column: 1;
        grid-row: 1;
    }
    
    .entity-value {
        grid-column: 1;
        grid-row: 2;
        margin-top: 0.5rem;
    }
    
    .entity-delete-btn {
        grid-column: 2;
        grid-row: 1;
    }
    
    .extraction-actions {
        flex-direction: column;
    }
    
    .settings-tabs {
        flex-wrap: wrap;
    }
}

@media (max-width: 576px) {
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .notification {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        max-width: none;
    }
}