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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    text-align: center;
    margin-bottom: 40px;
    color: #333;
}

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

.header p {
    font-size: 1.2rem;
    color: #666;
}

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 10px;
    gap: 10px;
}

.tab-button {
    background: transparent;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tab-button.active {
    background: #333;
    color: white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.tab-content {
    display: none;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.control-panel {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.control-group {
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
}

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group:has(.toggle-box) {
    flex: 0 0 150px;
    min-width: 150px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin: 0;
    transform: scale(1.2);
    accent-color: #333;
}

.form-group label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    padding: 12px 0;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.form-group label:has(input[type="checkbox"]):hover {
    background-color: rgba(51, 51, 51, 0.05);
    padding: 12px 8px;
}

.toggle-box {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    background: #333;
    color: white;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.toggle-box:hover {
    background: #555;
}

.toggle-box.disabled {
    background: #666;
    color: #ccc;
}

.toggle-box.disabled:hover {
    background: #777;
}

.btn {
    background: #333;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
    justify-content: center;
}

.btn:active {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn.success {
    background: #333;
}

.btn.danger {
    background: #666;
}

.file-upload {
    border: 3px dashed #ccc;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
}

.file-upload.dragover {
    border-color: #333;
    background: #f5f5f5;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.result-card {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.result-card h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-image {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    margin-bottom: 15px;
}

.download-hover {
    cursor: pointer;
}

.download-hover:hover {
    opacity: 0.8;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.stat-item {
    background: #333;
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

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

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #333;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #333;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-right: 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.error {
    background: #666;
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cell-data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.cell-data-table th {
    background: #333;
    color: white;
    padding: 12px;
    text-align: left;
}

.cell-data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
}

.calibration-section {
    margin-bottom: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
}

.calibration-header {
    background: #f8f9fa;
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calibration-header:hover {
    background: #e9ecef;
}

.calibration-header h4 {
    margin: 0;
    font-size: 1.1rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.calibration-content {
    padding: 20px;
    background: white;
    display: none;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    padding: 0;
    margin: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #333;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #333;
    cursor: pointer;
    border: none;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 8px;
    cursor: pointer;
    background: #ddd;
    border-radius: 5px;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .control-group {
        flex-direction: column;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

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