
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #f4f6f9;
    color: #263238;
}

.container {
    max-width: 1100px;
    margin: 40px auto;
    padding: 20px;
}

header {
    margin-bottom: 35px;
}

header h1 {
    font-size: 30px;
    color: #17365d;
}

header p {
    color: #64748b;
    margin-top: 8px;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.card h2 {
    font-size: 19px;
    margin-bottom: 12px;
}

.description {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 20px;
}

.upload-area {
    border: 2px dashed #cbd5e1;
    padding: 35px;
    text-align: center;
    border-radius: 8px;
}

.upload-button {
    display: inline-block;
    background: #2563eb;
    color: white;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
}

.upload-button:hover {
    background: #1d4ed8;
}

#fileName {
    margin-top: 15px;
    font-size: 14px;
    color: #64748b;
}

#initiateLearning {
    background: #15803d;
    color: white;
    padding: 13px 25px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}

#initiateLearning:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

footer {
    text-align: center;
    padding: 20px;
    color: #94a3b8;
    font-size: 13px;
}


.dataset-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 18px;
}

.stat-label {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 10px;
}

.stat-value {
    color: #17365d;
    font-size: 22px;
    overflow-wrap: anywhere;
}

.variables-section {
    margin-top: 25px;
}

.variables-section h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.variables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.variable-tag {
    background: #eaf1fb;
    color: #17365d;
    padding: 7px 13px;
    border-radius: 5px;
    font-size: 13px;
}

.empty-message {
    color: #94a3b8;
    font-size: 14px;
    padding: 15px 0;
}

@media (max-width: 700px) {
    .dataset-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}


.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 14px;
}

.data-table th {
    background: #f1f5f9;
    color: #17365d;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.data-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.data-table tbody tr:hover {
    background: #eff6ff;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.preview-info {
    margin-top: 12px;
    font-size: 13px;
    color: #64748b;
}


#initiateLearning {
    margin-top: 15px;
    padding: 12px 24px;
    background: #17365d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
}

#initiateLearning:hover:not(:disabled) {
    background: #244b78;
}

#initiateLearning:disabled {
    background: #94a3b8;
    cursor: not-allowed;
}

#learningStatus {
    margin-top: 15px;
    font-size: 14px;
    color: #475569;
}



/* ==========================================
   UPLOAD BUTTON - ORDER SMC
========================================== */

#uploadButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin-top: 20px;
    padding: 13px 30px;

    background: #17365d;
    color: #ffffff;

    border: none;
    border-radius: 8px;

    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;

    cursor: pointer;

    box-shadow: 0 3px 8px rgba(23, 54, 93, 0.18);

    transition: background 0.2s ease,
                transform 0.2s ease,
                box-shadow 0.2s ease;
}

#uploadButton:hover:not(:disabled) {
    background: #244b78;
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(23, 54, 93, 0.25);
}

#uploadButton:active:not(:disabled) {
    transform: translateY(0);
}

#uploadButton:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.75;
}

#uploadButton:focus-visible {
    outline: 3px solid #93c5fd;
    outline-offset: 3px;
}

/* Keep file selection button consistent */

.upload-button {
    background: #2563eb;
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s ease,
                transform 0.2s ease;
}

.upload-button:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}



/* ==========================================
   STRUCTURE LEARNING RESULTS
   ========================================== */

#learningResults[hidden] {
    display: none;
}

#learningResults {
    margin-top: 30px;
}

.results-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.results-section h3 {
    margin-bottom: 15px;
}

.dag-container {
    width: 100%;
    height: 500px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.posterior-table-wrapper {
    max-height: 500px;
    overflow: auto;
}

.posterior-table-wrapper thead th {
    position: sticky;
    top: 0;
    background-color: #f8fafc;
    z-index: 1;
}

#learningStatus {
    margin-top: 15px;
}


/* ==========================================
   Example Dataset Selection
   ========================================== */

.dataset-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
}

.dataset-divider::before,
.dataset-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background-color: #dbe2ea;
}

.example-dataset {
    padding: 24px;
    border: 1px solid #dbe2ea;
    border-radius: 8px;
    background-color: #f8fafc;
}

.example-dataset h3 {
    margin: 0 0 16px;
    font-size: 18px;
}

.example-dataset h4 {
    margin: 0 0 10px;
    font-size: 16px;
}

.example-dataset-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 16px 0;
}

.example-dataset-stats span {
    padding: 6px 12px;
    border: 1px solid #dbe2ea;
    border-radius: 5px;
    background-color: #ffffff;
    font-size: 13px;
    color: #334155;
}

.dataset-source {
    margin: 12px 0 18px;
    font-size: 13px;
    color: #64748b;
}

.dataset-source a {
    color: #2563eb;
    text-decoration: none;
}

.dataset-source a:hover {
    text-decoration: underline;
}

#loadExampleDataset {
    background-color: #17365d;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transition: background-color 0.2s ease;
}

#loadExampleDataset:hover:not(:disabled) {
    background-color: #24476f;
}

#loadExampleDataset:disabled {
    background-color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
}