/* Color Variables */
:root {
    --erm-primary: #4F46E5;
    --erm-primary-hover: #4338ca;
    --erm-bg: #F9FAFB;
    --erm-card-bg: #FFFFFF;
    --erm-text-main: #111827;
    --erm-text-muted: #6B7280;
    --erm-border: #E5E7EB;
    --erm-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --erm-radius: 12px;
}

.erm-wrapper {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--erm-text-main);
    display: flex;
    justify-content: center;
    padding: 2rem 0;
    box-sizing: border-box;
    width: 100%;
}

.erm-main-container {
    width: 100%;
    max-width: 100%;
    /* Wider for tables */
    background: transparent;
}

/* Tabs */
.erm-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--erm-border);
    padding-bottom: 2px;
    flex-wrap: wrap;
}

.erm-tab-btn {
    background: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--erm-text-muted);
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
    position: relative;
    top: 2px;
    border-bottom: 2px solid transparent;
}

.erm-tab-btn:hover {
    color: var(--erm-primary);
}

.erm-tab-btn.active {
    color: var(--erm-primary);
    border-bottom-color: var(--erm-primary);
    background: #eff6ff;
}

.erm-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

/* Existing Card Styles (modified for use within tab) */
.erm-card {
    background: var(--erm-card-bg);
    border-radius: var(--erm-radius);
    box-shadow: var(--erm-shadow);
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    border: 1px solid var(--erm-border);
    transition: transform 0.2s ease;
    box-sizing: border-box;
    margin: 0 auto;
    /* Center the form card */
}

.erm-card-header {
    margin-bottom: 2rem;
    text-align: center;
}

.erm-card-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--erm-text-main);
    line-height: 1.2;
}

.erm-card-header p {
    margin: 0.5rem 0 0;
    color: var(--erm-text-muted);
    font-size: 0.95rem;
}

.erm-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.erm-input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--erm-text-main);
}

.erm-input-wrapper {
    position: relative;
}

.erm-input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--erm-border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    box-sizing: border-box;
    background: #fff;
    color: var(--erm-text-main);
}

.erm-input-wrapper input:focus {
    border-color: var(--erm-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.erm-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--erm-text-muted);
    pointer-events: none;
    display: flex;
}

.erm-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--erm-border);
    border-radius: 8px;
    margin-top: 4px;
    box-shadow: var(--erm-shadow);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.erm-suggestion-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--erm-border);
    transition: background 0.1s;
    display: flex;
    justify-content: space-between;
}

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

.erm-suggestion-item:hover {
    background: #F3F4F6;
}

.erm-suggestion-item .s-name {
    font-weight: 500;
}

.erm-suggestion-item .s-id {
    color: var(--erm-text-muted);
    font-size: 0.85rem;
}

.erm-details {
    animation: fadeIn 0.4s ease;
    border-top: 1px solid var(--erm-border);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

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

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

.erm-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.erm-info-item {
    display: flex;
    flex-direction: column;
}

.erm-info-item .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--erm-text-muted);
    margin-bottom: 0.25rem;
}

.erm-info-item .value {
    font-weight: 600;
    font-size: 1rem;
    color: var(--erm-text-main);
}

.erm-update-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--erm-text-main);
}

.erm-action-row {
    display: flex;
    gap: 0.5rem;
}

.erm-action-row input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--erm-border);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    width: 60px;
    /* fallback */
    background: #fff;
    color: var(--erm-text-main);
}

.erm-btn {
    background: var(--erm-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.erm-btn:hover {
    background: var(--erm-primary-hover);
}

.erm-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.erm-message {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    display: none;
    text-align: center;
}

.erm-message.success {
    background: #D1FAE5;
    color: #065F46;
}

.erm-message.error {
    background: #FEE2E2;
    color: #991B1B;
}

/* Spinner */
.spinner {
    animation: rotate 2s linear infinite;
    width: 20px;
    height: 20px;
    margin-left: 8px;
}

.spinner .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

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

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }

    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }

    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* Data Tables for Lists */
.erm-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--erm-border);
}

.erm-list-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.erm-refresh-btn {
    background: white;
    border: 1px solid var(--erm-border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--erm-text-main);
}

.erm-refresh-btn:hover {
    background: #f9fafb;
    border-color: var(--erm-text-muted);
}

.erm-table-wrapper {
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--erm-border);
    overflow-x: auto;
    box-shadow: var(--erm-shadow);
}

.erm-data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.erm-data-table th,
.erm-data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--erm-border);
}

.erm-data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--erm-text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

.status-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-collected {
    background: #D1FAE5;
    color: #065F46;
}

.status-pending {
    background: #FEF3C7;
    color: #92400E;
}