* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px;
    background: white;
}

/* Responsive padding untuk mobile */
@media (max-width: 768px) {
    body {
        padding: 10px;
        margin: 0;
    }
}

h1 {
    color: #ffffff;
    text-align: center;
    margin-bottom: 10px;
    font-size: clamp(1.2rem, 5vw, 2rem);
}

h3 {
    color: #04926c;
    text-align: center;
    margin-bottom: 10px;
    font-size: clamp(1rem, 4vw, 1.5rem);
}

.card {
    background: white;
    border-radius: 16px;
    padding: 5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 25px;
}

textarea {
    width: 100%;
    height: 180px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #bbb;
    background: #fefef5;
}

/* Responsive textarea */
@media (max-width: 768px) {
    textarea {
        height: 150px;
        font-size: 12px;
        padding: 8px;
    }
}

.action-group button {
    background: none;
    border: none;
    color: #04926c;
    cursor: pointer;
    padding: 8px 12px;
    font-family: 'Segoe UI';
    font-size: 15px;
    transition: all 0.3s ease;
}

/* Touch-friendly button size untuk mobile */
@media (max-width: 768px) {
    .action-group button {
        padding: 10px 15px;
        font-size: 14px;
        min-height: 44px;
    }
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #cbd5e0;
}

/* Responsive action bar */
@media (max-width: 768px) {
    .action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .action-group {
        justify-content: center;
        flex-wrap: wrap;
    }
}

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

@media (max-width: 480px) {
    .action-group {
        flex-direction: column;
        width: 100%;
    }

    .action-group button {
        width: 100%;
    }
}

.result-box {
    background: #eef2fa;
    padding: 20px;
    border-radius: 15px;
    overflow-x: auto;
    margin-top: 10px;
    animation: fadeIn 0.3s ease;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .result-box {
        padding: 12px;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.data-table {
    width: auto;
    min-width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    font-size: 13px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

/* Responsive table dengan horizontal scroll */
@media (max-width: 768px) {
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 11px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
}

.data-table th,
.data-table td {
    border: 1px solid #cbd5e0;
    padding: 10px 8px;
    text-align: center;
    vertical-align: middle;
}

.data-table th {
    background-color: #2c5282;
    color: white;
    font-weight: 600;
}

.note {
    font-size: 13px;
    color: #2d3748;
    margin-top: 12px;
    margin-bottom: 15px;
    background: #f9f9e0;
    padding: 8px 12px;
    border-radius: 10px;
    border-left: 4px solid #ecc94b;
}

@media (max-width: 768px) {
    .note {
        font-size: 12px;
        padding: 10px;
    }
}

.interpretasi {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 20px;
    display: inline-block;
}

.normal {
    background-color: #c6f6d5;
    color: #22543d;
}

.tidak-normal {
    background-color: #fed7d7;
    color: #9b2c2c;
}

.chart-container {
    max-width: 650px;
    margin: 20px auto;
    background: white;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .chart-container {
        margin: 15px auto;
        padding: 10px;
    }
}

.chart-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .chart-grid {
        gap: 15px;
    }
}

.chart-card {
    flex: 1;
    min-width: 300px;
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 500px;
}

@media (max-width: 768px) {
    .chart-card {
        min-width: 100%;
        min-height: auto;
        padding: 12px;
    }
}

.chart-card h4 {
    text-align: center;
    color: #1e3a5f;
    margin-bottom: 15px;
    font-size: clamp(0.9rem, 4vw, 1.1rem);
}

canvas {
    max-height: 550px;
    width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    canvas {
        max-height: 300px;
    }
}

.korelasi-kuat {
    background-color: #ffcccc;
    font-weight: bold;
}

.korelasi-sedang {
    background-color: #ffffcc;
}

select,
label {
    font-size: 14px;
}

/* Responsive selects untuk mobile */
@media (max-width: 768px) {

    select,
    label {
        font-size: 13px;
    }

    select {
        padding: 8px;
        min-height: 44px;
    }
}

.var-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

@media (max-width: 768px) {
    .var-selector {
        flex-direction: column;
        align-items: stretch;
    }
}

.regression-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: #e2e8f0;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .regression-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
    }
}

footer {
    text-align: center;
    margin-top: 25px;
    font-size: 12px;
    color: #4a5568;
}

@media (max-width: 768px) {
    footer {
        font-size: 10px;
        margin-top: 20px;
    }
}

.output-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2c5282;
    color: #1e3a5f;
}

@media (max-width: 768px) {
    .output-title {
        font-size: 16px;
        margin-bottom: 12px;
    }
}

.reliability-badge {
    font-size: 16px;
    font-weight: bold;
    margin: 15px 0;
    padding: 10px;
    border-radius: 12px;
    text-align: center;
}

@media (max-width: 768px) {
    .reliability-badge {
        font-size: 14px;
        padding: 8px;
    }
}

.good {
    background-color: #c6f6d5;
    color: #22543d;
}

.moderate {
    background-color: #feebc8;
    color: #7b341e;
}

.poor {
    background-color: #fed7d7;
    color: #9b2c2c;
}

.assumption-pass {
    color: #22543d;
    background-color: #c6f6d5;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}

.assumption-fail {
    color: #9b2c2c;
    background-color: #fed7d7;
    padding: 2px 8px;
    border-radius: 20px;
    display: inline-block;
}

select[multiple] {
    min-height: 100px;
}

@media (max-width: 768px) {
    select[multiple] {
        min-height: 120px;
        font-size: 13px;
    }
}

.instruction-tip {
    font-size: 12px;
    color: #4a5568;
    margin-top: 5px;
    margin-bottom: 15px;
    font-style: italic;
    background: #e2e8f0;
    padding: 8px 12px;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .instruction-tip {
        font-size: 11px;
        padding: 10px;
    }
}

.action-bar button {
    font-weight: bold;
}

/* Logistic Regression Tables */
.logistic-table {
    width: auto;
    min-width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 13px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Responsive logistic table */
@media (max-width: 768px) {
    .logistic-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 11px;
    }

    .logistic-table th,
    .logistic-table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
}

.logistic-table th {
    background: linear-gradient(135deg, #04926c, #04926c);
    color: white;
    padding: 12px 10px;
    font-weight: 600;
    text-align: center;
}

.logistic-table td {
    border: 1px solid #ddd;
    padding: 10px 8px;
    text-align: center;
}

.logistic-table tr:nth-child(even) {
    background-color: #ffffff;
}

.logistic-table tr:hover {
    background-color: #ffffff;
}

.logistic-table td:first-child,
.logistic-table th:first-child {
    font-weight: 600;
    text-align: left;
}

.stat-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 14px;
}

/* Responsive stat table */
@media (max-width: 768px) {
    .stat-table {
        display: block;
        overflow-x: auto;
        font-size: 12px;
        -webkit-overflow-scrolling: touch;
    }

    .stat-table th,
    .stat-table td {
        padding: 8px;
        white-space: nowrap;
    }
}

.stat-table th,
.stat-table td {
    border: 1px solid #ddd;
    padding: 10px;
    text-align: left;
}

.stat-table th {
    background-color: #004d40;
    color: white;
    font-weight: bold;
}

.stat-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.stat-table tr:hover {
    background-color: #f5f5f5;
}

/* Path Analysis Styles */
#pathAnalysisOutput {
    display: none;
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    #pathAnalysisOutput {
        padding: 12px;
    }
}

.path-diagram-container {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .path-diagram-container {
        padding: 12px;
    }
}

table {
    font-size: 13px;
}

table th,
table td {
    padding: 10px;
}

/* Responsive umum untuk tablet */
@media (max-width: 1024px) and (min-width: 769px) {
    .chart-card {
        min-width: 280px;
    }

    .data-table,
    .logistic-table,
    .stat-table {
        font-size: 12px;
    }
}

/* Touch-friendly untuk semua interactive elements */
@media (hover: none) and (pointer: coarse) {

    button,
    select,
    .action-group button,
    input[type="file"] {
        min-height: 44px;
    }

    button:active,
    .action-group button:active {
        transform: scale(0.98);
    }
}

/* Perbaikan untuk landscape mode di mobile */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 10px;
    }

    textarea {
        height: 120px;
    }

    .chart-card {
        min-height: 350px;
    }

    canvas {
        max-height: 250px;
    }
}