:root {
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --border-color: #dee2e6;
    --header-bg: #e9ecef;
    --card-bg: #ffffff;
    --accent-color: #dc3545;
    --accent-hover: #c82333;
    --danger-color: #dc3545;
    --success-color: #198754;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --grid-header-bg: #f1f3f5;
    --drop-area-border: #ced4da;
    --drop-area-active: #f8d7da;
}

[data-theme="dark"] {
    --bg-color: #000000;
    --text-color: #f8f9fa;
    --border-color: #212529;
    --header-bg: #121212;
    --card-bg: #121212;
    --accent-color: #dc3545;
    --accent-hover: #c82333;
    --danger-color: #dc3545;
    --success-color: #198754;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --grid-header-bg: #1a1a1a;
    --drop-area-border: #212529;
    --drop-area-active: #dc3545;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

header {
    background-color: var(--header-bg);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

h2 {
    margin: 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.25rem;
    color: var(--text-color);
}

.card {
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.drop-area {
    border: 2px dashed var(--drop-area-border);
    border-radius: 0.5rem;
    padding: 2.5rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s, background-color 0.3s;
    margin-bottom: 1.5rem;
}

.drop-area.active {
    border-color: var(--accent-color);
    background-color: var(--drop-area-active);
    opacity: 0.8;
}

.drop-area:hover {
    border-color: var(--accent-color);
    background-color: rgba(220, 53, 69, 0.05);
}

.drop-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.drop-area p {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.drop-area small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-color);
    opacity: 0.7;
}

.button {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.3s, transform 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

#file-input {
    display: none;
}

#serial-search {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    #serial-search {
        flex-direction: row;
        align-items: center;
    }
}

#serial-input {
    flex-grow: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: border-color 0.3s;
}

@media (min-width: 768px) {
    #serial-input {
        margin-right: 0.5rem;
        margin-bottom: 0;
    }
}

#serial-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

#result {
    display: none;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(220, 53, 69, 0.2);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.info-section {
    margin-bottom: 1.5rem;
}

.section-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.info-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 0.25rem;
    background-color: rgba(0, 0, 0, 0.03);
    transition: background-color 0.2s;
}

[data-theme="dark"] .info-item {
    background-color: rgba(255, 255, 255, 0.03);
}

.info-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .info-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.info-label {
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
    color: var(--accent-color);
}

.info-value {
    word-break: break-all;
    position: relative;
}

.code-value {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    overflow-x: auto;
}

[data-theme="dark"] .code-value {
    background-color: rgba(255, 255, 255, 0.05);
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-good {
    background-color: var(--success-color);
    color: white;
}

.status-expired {
    background-color: var(--danger-color);
    color: white;
    animation: pulse 2s infinite;
}

.status-revoked {
    background-color: var(--danger-color);
    color: white;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.error-message {
    background-color: var(--danger-color);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: none;
}

.copy-btn {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 0.25rem;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
}

.info-value:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background-color: var(--accent-hover);
}

.entitlements-section {
    margin-top: 1.5rem;
}

.entitlements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    cursor: pointer;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.entitlements-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.toggle-icon {
    transition: transform 0.3s;
    font-size: 1.2rem;
}

.toggle-icon.expanded {
    transform: rotate(180deg);
}

.entitlements-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: visible;
    transition: all 0.3s ease-out;
}

.entitlements-container.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
}

.entitlement-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.entitlement-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: var(--grid-header-bg);
}

.entitlement-card:active {
    transform: translateY(0);
}

.entitlement-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    cursor: default;
    border-bottom: none;
    padding-bottom: 0;
}

.entitlement-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: white;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.entitlement-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.entitlement-name {
    font-size: 0.9rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.25rem 0;
    font-family: monospace;
}

.entitlement-value-container {
    background-color: var(--grid-header-bg);
    padding: 0.75rem 1rem;
    border-radius: 0.25rem;
    word-break: break-all;
}

.entitlement-value.boolean {
    font-weight: 600;
    font-size: 1rem;
}

.entitlement-value-array {
    font-family: monospace;
    font-size: 0.85rem;
}

.array-item {
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.true-value {
    color: var(--success-color);
}

.false-value {
    color: var(--danger-color);
}

#fileName {
    margin-top: 0.5rem;
    font-style: italic;
    opacity: 0.8;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.summary-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    margin-bottom: 0.5rem;
}

.summary-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.revocation-text {
    color: var(--danger-color);
    font-weight: 500;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    display: block;
}

/* Responsive improvements for entitlements on smaller screens */
@media (max-width: 768px) {
    .entitlement-card {
        padding: 1rem;
    }

    .entitlement-header {
        gap: 0.5rem;
    }

    .entitlement-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .entitlement-title {
        font-size: 1rem;
    }

    .entitlement-name {
        font-size: 0.8rem;
    }
}

.info-banner {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.banner-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

@media (min-width: 768px) {
    .banner-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.banner-text {
    flex: 1;
}

.banner-text strong {
    display: block;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.banner-text p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color);
    opacity: 0.85;
}

.banner-button {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
    border-radius: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.banner-button:hover {
    background-color: var(--accent-hover);
}
