/* Sky Blue Color Palette */
:root {
    --primary: #0ea5e9;
    --secondary: #f0f9ff;
    --accent: #0284c7;
    --light: #e0f2fe;
    --dark: #0369a1;
    --text: #1e293b;
    --error: #ef4444;
    --success: #10b981;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--secondary);
    color: var(--text);
}

header {
    background-color: var(--primary);
    color: white;
    padding: 1rem;
    text-align: center;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

section {
    background-color: white;
    margin-bottom: 2rem;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

h2 {
    color: var(--primary);
    margin-top: 0;
}

.drop-zone {
    border: 2px dashed var(--accent);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.drop-zone:hover, .drop-zone.dragover {
    background-color: var(--light);
}

.json-preview {
    margin-top: 1rem;
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 1rem;
}

button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--dark);
}

#data-list, #jobs-list {
    margin-top: 1rem;
}

.data-item, .job-item {
    border: 1px solid var(--light);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
    background-color: var(--secondary);
}

.data-item h3, .job-item h3 {
    margin-top: 0;
    color: var(--primary);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-waiting { background-color: #fbbf24; color: white; }
.status-processing { background-color: #f59e0b; color: white; }
.status-processed { background-color: var(--success); color: white; }
.status-errored { background-color: var(--error); color: white; }

.alert {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 1rem;
    border-radius: 4px;
    color: white;
    z-index: 1000;
}

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

.expandable {
    cursor: pointer;
    color: var(--accent);
}

.expandable:hover {
    text-decoration: underline;
}

.expanded-content {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: var(--light);
    border-radius: 4px;
    white-space: pre-wrap;
}
.expandable {
    color: #0284c7; /* Deep Sky Blue */
    cursor: pointer;
    border-bottom: 1px dashed #bae6fd; /* Light Sky Blue underline */
    transition: background-color 0.3s;
}

.expandable:hover {
    background-color: #f0f9ff; /* Very faint sky blue highlight */
}

.expanded {
    color: #0369a1; /* Slightly darker blue when open */
    border-bottom: none;
    display: block; /* Ensure long text wraps nicely */
    background-color: #f8fafc;
    padding: 10px;
    border-left: 4px solid #0ea5e9;
}

.violation-list {
    list-style: none;
    padding: 0;
}

.violation-item {
    background-color: #f0f9ff; /* Lightest sky blue */
    border-left: 4px solid #0ea5e9; /* Sky blue accent */
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 0 4px 4px 0;
}

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

.category {
    font-weight: bold;
    color: #0369a1; /* Darker blue for text */
    text-transform: uppercase;
    font-size: 0.85rem;
}

.probability-badge {
    background-color: #bae6fd; /* Medium sky blue */
    color: #0369a1;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.reasoning {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    color: #334155;
    line-height: 1.4;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light);
}

.pagination-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    min-width: 90px;
}

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

.pagination-btn:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
}

.pagination-indicator {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
    min-width: 100px;
    text-align: center;
}

/* Data Item Header with Edit Button */
.data-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.data-item-header h3 {
    margin: 0;
}

.edit-btn {
    background-color: var(--accent);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.3s;
}

.edit-btn:hover {
    background-color: var(--dark);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--light);
    background-color: var(--secondary);
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    margin: 0;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--error);
    background: none;
}

#edit-form {
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    color: var(--text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--light);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.form-group input[readonly] {
    background-color: var(--light);
    color: var(--text);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light);
}

.btn-cancel {
    background-color: #94a3b8;
    color: white;
}

.btn-cancel:hover {
    background-color: #64748b;
}

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

.btn-save:hover {
    background-color: #059669;
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
    flex: 1;
}

.autocomplete-wrapper input {
    width: 100%;
    box-sizing: border-box;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--light);
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.autocomplete-item {
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    border-bottom: 1px solid var(--light);
}

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

.autocomplete-item:hover {
    background-color: var(--light);
    color: var(--primary);
}

/* Job ID Button - clickable link style */
.job-id-btn {
    background-color: transparent;
    color: var(--primary);
    border: none;
    padding: 0;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.3s, text-shadow 0.3s;
    font-size: inherit;
}

.job-id-btn:hover {
    color: var(--dark);
    text-shadow: 0 0 4px rgba(14, 165, 233, 0.5);
    background-color: transparent;
}

.job-id-btn:active {
    color: var(--accent);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--light);
}

.tab-btn {
    background: none;
    color: var(--text);
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1.5rem;
    border-radius: 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

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

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: none;
}

/* Labeler */
.labeler-progress {
    color: var(--text);
    font-style: italic;
    padding: 1rem 0;
}

.labeler-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.labeler-counter {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
    background: var(--light);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}

.labeler-customer {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
}

.labeler-state-badge {
    background-color: var(--light);
    color: var(--dark);
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
}

.labeler-already-labeled {
    background-color: #dcfce7;
    color: #166534;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.labeler-unclassified {
    background-color: #fef3c7;
    color: #92400e;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Override status-badge size inside labeler meta for Case Type */
.labeler-meta .status-badge {
    font-size: 1rem;
    padding: 0.35rem 0.75rem;
}

.labeler-context {
    background: var(--secondary);
    border-left: 4px solid var(--primary);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    border-radius: 0 4px 4px 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.labeler-markdown {
    background: var(--secondary);
    border: 1px solid var(--light);
    border-radius: 4px;
    padding: 1rem;
    max-height: 420px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.labeler-markdown h1,
.labeler-markdown h2,
.labeler-markdown h3 {
    color: var(--primary);
    margin-top: 0.75rem;
}

.labeler-markdown a {
    color: var(--accent);
}

.labeler-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.labeler-option {
    border: 2px solid var(--light);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.labeler-option:hover {
    border-color: var(--primary);
    background-color: var(--secondary);
}

.labeler-option.selected {
    border-color: var(--primary);
    background-color: var(--light);
}

.option-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    font-size: 1rem;
}

.option-header input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.option-header label {
    cursor: pointer;
}

.labeler-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--light);
}

.labeler-nav button {
    min-width: 120px;
}

#labeler-submit {
    background-color: var(--success);
    min-width: 140px;
}

#labeler-submit:hover:not(:disabled) {
    background-color: #059669;
}

#labeler-submit:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
}

#labeler-prev:disabled,
#labeler-next:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
}

#labeler-none {
    background-color: #f59e0b;
    min-width: 160px;
}

#labeler-none:hover:not(:disabled) {
    background-color: #d97706;
}

#labeler-none:disabled {
    background-color: #cbd5e1;
    cursor: not-allowed;
}