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

:root {
    --primary-color: #0052CC;
    --primary-hover: #0747A6;
    --success-color: #00875A;
    --warning-color: #FF991F;
    --error-color: #DE350B;
    --text-primary: #172B4D;
    --text-secondary: #6B778C;
    --background: #FAFBFC;
    --surface: #FFFFFF;
    --border-color: #DFE1E6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --transition: all 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

h1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
}

.language-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.language-selector select:hover {
    border-color: var(--primary-color);
}

.language-selector select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

main {
    margin-bottom: 2rem;
}

.input-section {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
}

.input-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

.input-area {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#certInput {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    resize: vertical;
    transition: var(--transition);
    background: var(--background);
}

#certInput:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--surface);
}

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--background);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.results-section {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    animation: slideIn 0.3s ease;
}

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

.results-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.chain-visualization {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: var(--background);
    border-radius: var(--radius);
}

.cert-node {
    width: 100%;
    max-width: 400px;
    padding: 1.25rem;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.cert-node:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.cert-node.root-ca {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(0, 135, 90, 0.05) 0%, rgba(0, 135, 90, 0.02) 100%);
}

.cert-node.intermediate-ca {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(0, 82, 204, 0.05) 0%, rgba(0, 82, 204, 0.02) 100%);
}

.cert-node.end-entity {
    border-color: var(--text-secondary);
}

.cert-node.expired {
    border-color: var(--error-color);
    background: linear-gradient(135deg, rgba(222, 53, 11, 0.05) 0%, rgba(222, 53, 11, 0.02) 100%);
}

.cert-node.expiring-soon {
    border-color: var(--warning-color);
    background: linear-gradient(135deg, rgba(255, 153, 31, 0.05) 0%, rgba(255, 153, 31, 0.02) 100%);
}

.cert-type {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.cert-name {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
}

.cert-validity-status {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.expired .cert-validity-status {
    color: var(--error-color);
}

.expiring-soon .cert-validity-status {
    color: var(--warning-color);
}

.not-yet-valid .cert-validity-status {
    color: var(--error-color);
}

.chain-arrow {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin: 1rem 0;
}

.certificate-details {
    background: var(--background);
    padding: 1.5rem;
    border-radius: var(--radius);
}

.cert-detail-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.cert-detail-card h3:first-child {
    margin-top: 0;
}

.detail-content {
    padding: 0.75rem;
    background: var(--surface);
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.detail-content pre {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-primary);
}

.detail-content code {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    color: var(--text-primary);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--background);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.san-list {
    list-style: none;
    padding: 0;
}

.san-list li {
    padding: 0.25rem 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.fingerprint {
    font-size: 0.75rem !important;
    line-height: 1.6;
}

.error-message {
    background: linear-gradient(135deg, rgba(222, 53, 11, 0.1) 0%, rgba(222, 53, 11, 0.05) 100%);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    font-weight: 500;
}

footer {
    background: var(--surface);
    padding: 3rem 2rem 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.feature {
    text-align: center;
}

.feature svg {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.feature p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.copyright {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    header {
        flex-direction: column;
        gap: 1rem;
        padding: 1.25rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    .input-section, .results-section {
        padding: 1.5rem;
    }
    
    .cert-node {
        max-width: 100%;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .detail-row {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    footer {
        padding: 2rem 1.5rem 1.5rem;
    }
}