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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #f5f5f5;
    color: #333;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h3 {
    margin-top: 0;
    color: #555;
}

h4 {
    margin-top: 15px;
    margin-bottom: 10px;
    color: #666;
}

.drop-zone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: white;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #999;
    background: #fafafa;
}

.drop-zone.drag-over {
    border-color: #007bff;
    background: #f0f8ff;
    transform: scale(1.02);
}

.drop-zone p {
    margin: 10px 0;
    color: #666;
    font-size: 16px;
}

#fileInput {
    display: none;
}

.toolbar {
    display: none;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-box:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-secondary {
    background: white;
    color: #333;
    border: 1px solid #ddd;
}

.button-secondary:hover {
    background: #f8f9fa;
    border-color: #999;
}

.error {
    padding: 15px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 4px;
    margin-bottom: 20px;
    color: #c33;
}

.error strong {
    display: block;
    margin-bottom: 5px;
}

.metadata-card {
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.metadata-card h3 {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.metadata-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.metadata-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-value {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}

.alarms-card {
    padding: 20px;
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.alarms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ff9800;
}

.alarms-count {
    background: #ff9800;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
}

.alarms-table {
    width: 100%;
    border-collapse: collapse;
}

.alarms-table th,
.alarms-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.alarms-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

.alarms-table tr:hover {
    background: #f9f9f9;
}

.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 0;
    flex-wrap: wrap;
}

.tab-button {
    padding: 12px 24px;
    border: none;
    background: white;
    cursor: pointer;
    border-radius: 4px 4px 0 0;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-button:hover {
    background: #f0f0f0;
}

.tab-button.active {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 5px rgba(0,123,255,0.3);
}

.content {
    background: white;
    padding: 20px;
    border-radius: 0 4px 4px 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow-x: auto;
    min-height: 400px;
}

.results {
    display: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

th, td {
    padding: 10px 12px;
    border: 1px solid #ddd;
    text-align: left;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    position: sticky;
    top: 0;
}

tbody tr:hover {
    background: #f9f9f9;
}

tbody tr:nth-child(even) {
    background: #fafafa;
}

tbody tr:nth-child(even):hover {
    background: #f5f5f5;
}

.unit-card {
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    padding: 20px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.unit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #007bff;
}

.unit-name {
    font-size: 20px;
    font-weight: 600;
    color: #007bff;
}

.unit-id {
    font-size: 14px;
    color: #666;
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 12px;
}

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

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.expandable-section {
    margin-top: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

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

.section-title {
    font-weight: 600;
    color: #333;
}

.expand-icon {
    font-size: 18px;
    color: #666;
}

.section-content {
    padding: 15px 0;
}

.channel-group {
    margin-bottom: 20px;
}

.channel-group-id {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.channel-item {
    padding: 12px;
    background: #fafafa;
    border-radius: 4px;
    border-left: 4px solid #007bff;
}

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

.channel-number {
    font-weight: 600;
    color: #333;
}

.channel-direction {
    font-size: 12px;
    font-weight: 500;
}

.channel-name {
    font-size: 14px;
    color: #555;
}

.hidden {
    display: none !important;
}

.icon {
    width: 32px;
    height: 32px;
    display: inline-block;
}

.footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
    text-align: center;
    color: #666;
    font-size: 14px;
}

.footer-separator {
    margin: 0 10px;
}

.footer-link {
    color: #007bff;
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

@media print {
    .drop-zone,
    .toolbar,
    .tabs,
    .footer {
        display: none !important;
    }

    .section-content {
        display: block !important;
    }

    body {
        background: white;
    }

    .unit-card,
    .metadata-card,
    .alarms-card {
        box-shadow: none;
        page-break-inside: avoid;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 24px;
    }

    .tab-button {
        padding: 10px 16px;
        font-size: 13px;
    }

    .content {
        padding: 15px;
    }

    table {
        font-size: 14px;
    }

    th, td {
        padding: 8px;
    }

    .metadata-grid,
    .unit-details {
        grid-template-columns: 1fr;
    }

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