.security-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    font-size: 1.6rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.grade-a {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.grade-b {
    background: linear-gradient(135deg, #20c997, #17a2b8);
}

.grade-c {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
}

.grade-d {
    background: linear-gradient(135deg, #fd7e14, #dc3545);
}

.grade-f {
    background: linear-gradient(135deg, #dc3545, #6f42c1);
}

.grade-unknown {
    background: linear-gradient(135deg, #6c757d, #495057);
}

/* Card styling */
.card {
    border-radius: 12px;
    border: 0 !important;
    /* native outline (animated via JS) */
    position: relative;
    box-shadow: none !important;
}

.card-header {
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
}

/* Specific styling for colored card headers */
.card-header.bg-warning {
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
}

/* Loading animation */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
    100% {
        opacity: 1;
    }
}

#loadingIndicator {
    animation: pulse 2s infinite;
    border-radius: 8px;
}

/* Code block styling */
pre {
    background-color: var(--bs-dark);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 1rem;
    margin: 0;
    overflow-x: auto;
    max-height: 400px;
}

pre code {
    color: var(--bs-light);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Custom scrollbar for code blocks */
pre::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

pre::-webkit-scrollbar-track {
    background: rgba(var(--bs-dark-rgb), 0.3);
    border-radius: 3px;
}

pre::-webkit-scrollbar-thumb {
    background: rgba(102, 16, 242, 0.6);
    border-radius: 3px;
    transition: background 0.2s ease;
}

pre::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 16, 242, 0.8);
}

pre::-webkit-scrollbar-corner {
    background: rgba(var(--bs-dark-rgb), 0.3);
}

/* Firefox scrollbar styling */
pre {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 16, 242, 0.6) rgba(var(--bs-dark-rgb), 0.3);
}

/* Status badges */
.badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* Compact badge size for header labels */
.badge-sm {
    font-size: 0.65rem;
    padding: 0.2em 0.5em;
    line-height: 1; /* keeps visual height tight */
    border-radius: 0.5rem;
}

/* Form styling */
.form-control {
    border-radius: 8px;
    border: 1px solid var(--bs-primary);
    transition: border-color 0.2s ease;
}

.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: none;
    outline: none;
}

/* Button styling */
.btn {
    border-radius: 8px;
    transition: opacity 0.2s ease;
}

.btn:hover {
    opacity: 0.9;
}

.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* Alert improvements */
.alert {
    border-radius: 12px;
    padding: 1rem 1.25rem;
    outline: 1px solid rgba(var(--bs-border-color-rgb), 0.3);
    outline-offset: 0px;
}

.alert-warning {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid var(--bs-warning);
    color: var(--bs-body-color);
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    border-left: 4px solid var(--bs-danger);
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    border-left: 4px solid var(--bs-success);
}

/* Normalize text/link colors inside alerts */
.alert p,
.alert span,
.alert small,
.alert a,
.alert code,
.alert li {
    color: var(--bs-body-color);
}

.alert a { color: inherit; }

/* Header status styling */
.border-warning {
    border-left: 4px solid var(--bs-warning) !important;
}

/* Navbar brand */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    transition: color 0.15s ease;
}

.navbar-brand:hover {
    color: var(--bs-primary) !important;
}

/* Navbar links */
.nav-link {
    border-radius: 6px;
    margin: 0 8px;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--bs-primary) !important;
}

/* Footer */
footer {
    margin-top: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .security-grade {
        width: 84px;
        height: 84px;
        font-size: 1.6rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Scroll margin for analysis summary */
#resultsSection {
    scroll-margin-top: 120px;
}

/* Precise anchor for first results card */
#results {
    scroll-margin-top: 120px;
}

/* Toast notifications */
.toast-notification {
    background: rgba(13, 13, 13, 0.95);
    border: 1px solid rgba(102, 16, 242, 0.3);
    border-radius: 12px;
    color: #ffffff;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toast-content {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    padding: 6px;
    margin-left: auto;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.toast-close i {
    font-size: 12px;
}

.toast-success {
    border-color: rgba(40, 167, 69, 0.5);
    background: rgba(13, 13, 13, 0.95);
}

.toast-success .toast-content i:first-child {
    color: #28a745;
}

.toast-danger {
    border-color: rgba(220, 53, 69, 0.5);
    background: rgba(13, 13, 13, 0.95);
}

.toast-danger .toast-content i:first-child {
    color: #dc3545;
}

.toast-warning {
    border-color: rgba(255, 193, 7, 0.5);
    background: rgba(13, 13, 13, 0.95);
}

.toast-warning .toast-content i:first-child {
    color: #ffc107;
}

.toast-info {
    border-color: rgba(102, 16, 242, 0.5);
    background: rgba(13, 13, 13, 0.95);
}

.toast-info .toast-content i:first-child {
    color: #6610f2;
}

/* Error notification styling */
.error-notification {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 12px;
    color: var(--bs-body-color);
    padding: 16px;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 20px rgba(220, 53, 69, 0.15);
}

.error-notification i:first-child {
    color: #dc3545;
    font-size: 1.2rem;
}

.error-notification strong {
    color: var(--bs-danger);
}

.error-notification p,
.error-notification span,
.error-notification small,
.error-notification a,
.error-notification code,
.error-notification li {
    color: var(--bs-body-color);
}

.error-notification a {
    color: inherit;
    text-decoration: underline;
}

.error-close {
    background: none;
    border: none;
    color: rgba(33, 37, 41, 0.6); /* fallback */
    color: color-mix(in srgb, var(--bs-body-color) 60%, transparent);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.error-close:hover {
    color: var(--bs-body-color);
    background: rgba(0, 0, 0, 0.06);
}

.error-close i {
    font-size: 12px;
}

/* Badge styling */
.badge {
    border-radius: 6px;
    outline: none;
    outline-offset: 0;
    transition: color 0.2s ease;
}

.badge:hover {
    outline: none;
    outline-offset: 0;
}

.shadow, .shadow-sm, .shadow-lg, .card.shadow {
    box-shadow: none !important;
}

/* Custom scrollbar for code blocks */
pre::-webkit-scrollbar {
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: var(--bs-dark);
}

pre::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: var(--bs-light);
}

/* Percentage inside grade circle */
.security-grade {
    position: relative;
}

.security-grade .grade-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: flex-end; /* bottom-align both columns */
    justify-content: center; /* center the pair horizontally */
    gap: 4px;
}

.security-grade .grade-letter {
    font-size: 2.0rem; /* larger letter for emphasis */
    font-weight: 800;
    line-height: 1;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.security-grade .grade-percent {
    font-size: 0.95rem; /* readable percent */
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}

.security-grade .score-inside {
    position: absolute;
    right: 6px;
    bottom: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    line-height: 1;
}
