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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: white;
}

header {
    background: #0070f2;
    color: white;
    padding: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #0051d5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 24px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 50px;
    width: auto;
    display: block;
}

header h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0;
}

.server-info {
    font-size: 13px;
    opacity: 0.95;
    font-weight: 400;
}

nav.tabs {
    display: flex;
    background: #ffffff;
    border-bottom: 1px solid #d1d1d1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.tab-button {
    padding: 14px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.tab-button.active {
    color: #0070f2;
    border-bottom-color: #0070f2;
    background: #fafafa;
    font-weight: 600;
}

main {
    padding: 24px;
    background: #f5f5f5;
    flex: 1;
    max-width: 100%;
    overflow-x: auto;
}

.tab-content {
    display: none;
}

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #d1d1d1;
}

.section-header > div {
    display: flex;
    gap: 10px;
    align-items: center;
}

.section-header h2 {
    font-size: 18px;
    color: #333;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.btn {
    padding: 8px 16px;
    border: 1px solid #d1d1d1;
    border-radius: 2px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    background: white;
    color: #333;
}

.btn-primary {
    background: #0070f2;
    color: white;
    border-color: #0070f2;
}

.btn-primary:hover {
    background: #0051d5;
    border-color: #0051d5;
    box-shadow: 0 2px 4px rgba(0, 112, 242, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
}

.auto-refresh-label {
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
}

.auto-refresh-label input[type="checkbox"] {
    margin-right: 5px;
    cursor: pointer;
}

/* Professional Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #d1d1d1;
    margin-top: 16px;
    table-layout: auto;
    min-width: 100%;
}

.data-table thead {
    background: #f0f0f0;
    border-bottom: 2px solid #d1d1d1;
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-right: 1px solid #d1d1d1;
    white-space: nowrap;
}

.data-table th.col-size,
.data-table th.col-status,
.data-table th.col-actions {
    text-align: center;
}

.data-table th:last-child {
    border-right: none;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e8e8e8;
    border-right: 1px solid #e8e8e8;
    font-size: 13px;
    color: #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.data-table td code {
    word-break: break-all;
    white-space: normal;
}

.data-table td:last-child {
    border-right: none;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Column width optimizations - auto width with min-width constraints */
.data-table th.col-matching-id,
.data-table td.col-matching-id {
    min-width: 200px;
}

.data-table th.col-filename,
.data-table td.col-filename {
    min-width: 250px;
}

.data-table th.col-size,
.data-table td.col-size {
    min-width: 80px;
    text-align: right;
}

.data-table th.col-modified,
.data-table td.col-modified {
    min-width: 160px;
}

.data-table th.col-status,
.data-table td.col-status {
    min-width: 100px;
    text-align: center;
}

.data-table th.col-actions,
.data-table td.col-actions {
    min-width: 140px;
    text-align: center;
    white-space: nowrap;
}

.data-table td.col-actions .btn {
    margin: 0 2px;
}

.data-table th.col-transaction-id,
.data-table td.col-transaction-id {
    min-width: 250px;
}

.data-table th.col-eid,
.data-table td.col-eid {
    min-width: 250px;
}

.data-table th.col-base-profile,
.data-table td.col-base-profile {
    min-width: 180px;
}

.data-table th.col-iccid,
.data-table td.col-iccid {
    min-width: 160px;
}

.data-table th.col-imsi,
.data-table td.col-imsi {
    min-width: 160px;
}

.data-table th.col-created,
.data-table td.col-created {
    min-width: 140px;
}

.data-table th.col-timestamp,
.data-table td.col-timestamp {
    min-width: 160px;
}

.data-table th.col-error,
.data-table td.col-error {
    min-width: 200px;
}

.card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.card {
    background: white;
    border: 1px solid #d1d1d1;
    border-radius: 2px;
    padding: 16px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: #0070f2;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e8e8e8;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.card-badge {
    padding: 3px 10px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.card-body {
    color: #666;
    font-size: 13px;
}

.card-item {
    margin: 6px 0;
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
}

.card-label {
    font-weight: 500;
    color: #666;
    min-width: 120px;
}

.card-value {
    color: #333;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    text-align: right;
}

.info-card {
    background: white;
    border: 1px solid #d1d1d1;
    border-radius: 2px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e8e8e8;
}

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

.info-label {
    font-weight: 600;
    color: #666;
    font-size: 13px;
    min-width: 200px;
}

.info-value {
    color: #333;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    text-align: right;
}

.loading {
    text-align: center;
    padding: 32px;
    color: #666;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: white;
    border: 1px solid #d1d1d1;
    border-radius: 2px;
}

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: #666;
    background: white;
    border: 1px solid #d1d1d1;
    border-radius: 2px;
}

.empty-state-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 2px;
    margin: 16px 0;
    border: 1px solid #f5c6cb;
    font-size: 13px;
    font-weight: 500;
}

.personalization-card {
    margin-bottom: 20px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-input.invalid-input {
    background-color: #ffe6e6;
    border-color: #ff4444;
    color: #cc0000;
}

.form-input.invalid-input:focus {
    outline-color: #ff4444;
    border-color: #ff4444;
    box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.2);
}

.form-input {
    padding: 8px 12px;
    border: 1px solid #d1d1d1;
    border-radius: 2px;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    background: white;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #0070f2;
    box-shadow: 0 0 0 2px rgba(0, 112, 242, 0.1);
}

.form-input::placeholder {
    color: #999;
    font-style: italic;
}

.form-actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-small {
    padding: 5px 10px;
    font-size: 12px;
}

code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 2px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #333;
    border: 1px solid #e0e0e0;
}

strong {
    font-weight: 600;
    color: #333;
}

em {
    color: #999;
    font-style: normal;
}

.create-profile-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

/* Collapsible groups */
.collapsible-group {
    grid-column: 1 / -1;
    border: 1px solid #d1d1d1;
    border-radius: 2px;
    background: white;
    margin-bottom: 8px;
    overflow: hidden;
}

.collapsible-header {
    width: 100%;
    padding: 12px 16px;
    background: #f0f0f0;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    transition: background-color 0.2s ease;
    text-align: left;
}

.collapsible-header:hover {
    background: #e0e0e0;
}

.collapsible-header[aria-expanded="true"] {
    background: #0070f2;
    color: white;
}

.collapsible-header[aria-expanded="true"] .element-type {
    color: white;
}

.collapsible-header[aria-expanded="true"] .element-id {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

.collapsible-header[aria-expanded="true"] .collapsible-icon {
    transform: rotate(180deg);
}

.collapsible-icon {
    transition: transform 0.3s ease;
    font-size: 12px;
    margin-left: 8px;
}

.collapsible-content {
    padding: 0 16px;
    max-height: 0;
    overflow: hidden;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    transition: max-height 0.3s ease, padding 0.3s ease;
    display: grid;
}

.collapsible-content.expanded {
    max-height: 2000px;
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.personalized-profiles-section h3 {
    margin-bottom: 16px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    border-bottom: 2px solid #d1d1d1;
}

.personalized-profile-card {
    margin-bottom: 20px;
}

.qr-code-section {
    margin: 16px 0;
    padding: 16px;
    background: #fafafa;
    border-radius: 2px;
    border: 1px solid #d1d1d1;
}

.qr-code-container {
    text-align: center;
    margin-bottom: 12px;
}

.qr-code-image {
    max-width: 256px;
    height: auto;
    border: 1px solid #d1d1d1;
    border-radius: 2px;
    padding: 8px;
    background: white;
}

.activation-code {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.activation-code label {
    font-weight: 500;
    color: #666;
}

.activation-code-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.copy-btn {
    white-space: nowrap;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 2px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid #d1d1d1;
    animation: slideDown 0.2s;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 2px solid #0051d5;
    background: #0070f2;
    color: white;
    border-radius: 2px 2px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: opacity 0.3s;
}

.modal-close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.profile-details {
    color: #333;
}

.detail-section {
    margin-bottom: 30px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h3 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 600;
    color: #0070f2;
    border-bottom: 2px solid #d1d1d1;
    padding-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.element-card {
    background: white;
    border: 1px solid #d1d1d1;
    border-radius: 2px;
    padding: 12px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.element-card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: #0070f2;
}

.element-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e0e0e0;
}

.element-type {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
}

.element-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.element-id {
    font-size: 12px;
    color: #666;
    background: #e8e8e8;
    padding: 4px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

.element-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.element-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.element-detail-label {
    font-weight: 500;
    color: #666;
    font-size: 13px;
}

.element-detail-value {
    color: #333;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
    padding-left: 8px;
}

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    padding-left: 8px;
}

.file-tag {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    padding: 3px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    font-weight: 500;
    border: 1px solid #bbdefb;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    main {
        padding: 16px;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 16px;
    }

    .header-logo {
        height: 50px;
    }

    header h1 {
        font-size: 18px;
    }

    nav.tabs {
        flex-wrap: wrap;
    }

    .tab-button {
        flex: 1 1 auto;
        min-width: 120px;
    }

    .card-list {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 12px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
        max-height: 85vh;
    }

    .modal-header {
        padding: 12px 16px;
    }

    .modal-body {
        padding: 16px;
    }
}
