/**
 * SSL Checker Specific Styles
 * 
 * @package CSR_Tools
 * @since 2.0.0
 */

/* ==========================================================================
   Grade Banner Styles
   ========================================================================== */
.grade-banner {
    position: relative;
    overflow: hidden;
}

.grade-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    animation: rotateGradient 10s linear infinite;
}

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

/* Grade number animation */
.grade-number {
    display: inline-block;
    animation: gradePulse 2s ease-in-out infinite;
}

@keyframes gradePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* ==========================================================================
   Security Analysis Grid
   ========================================================================== */
.security-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.security-item {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.security-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.security-item:hover::before {
    left: 100%;
}

.security-item:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Status icons animation */
.security-item .icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.security-item:hover .icon {
    transform: scale(1.2) rotate(5deg);
}

/* ==========================================================================
   Certificate Chain Styling
   ========================================================================== */
.chain-container {
    position: relative;
    padding-left: 30px;
}

.chain-container::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 50px;
    bottom: 50px;
    width: 3px;
    background: linear-gradient(to bottom, #6610f2 0%, #adb5bd 100%);
    opacity: 0.4;
}

.chain-item {
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.chain-item::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 50%;
    width: 10px;
    height: 10px;
    background: #6610f2;
    border-radius: 50%;
    transform: translateY(-50%);
    box-shadow: 0 0 0 3px rgba(102, 16, 242, 0.2);
    transition: all 0.3s ease;
}

.chain-item:hover::before {
    width: 16px;
    height: 16px;
    left: -33px;
    box-shadow: 0 0 0 6px rgba(102, 16, 242, 0.3);
}

.chain-item:hover {
    transform: translateX(8px);
    box-shadow: 0 6px 16px rgba(102, 16, 242, 0.25);
}

.chain-item:first-child {
    border-left-color: #6610f2 !important;
    border-left-width: 5px !important;
}

.chain-item:first-child::before {
    background: #6610f2;
    box-shadow: 0 0 0 3px rgba(102, 16, 242, 0.3);
}

/* ==========================================================================
   Recommendations Section
   ========================================================================== */
.recommendation-item {
    position: relative;
    transition: all 0.3s ease;
    cursor: pointer;
}

.recommendation-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    transition: all 0.3s ease;
}

.recommendation-item:hover::before {
    width: 8px;
}

.recommendation-item:hover {
    transform: translateX(6px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* Severity indicators */
.recommendation-item[data-severity="critical"] {
    border-left-color: #dc3545 !important;
}

.recommendation-item[data-severity="warning"] {
    border-left-color: #ffc107 !important;
}

.recommendation-item[data-severity="info"] {
    border-left-color: #0dcaf0 !important;
}

/* ==========================================================================
   Expiry Alert Animations
   ========================================================================== */
.expiry-alert {
    animation: slideInDown 0.6s ease;
}

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

.expiry-alert.critical {
    animation: pulseRed 2s ease-in-out infinite;
}

@keyframes pulseRed {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    }
    50% {
        box-shadow: 0 8px 24px rgba(220, 53, 69, 0.6);
    }
}

.expiry-alert.warning {
    animation: pulseYellow 3s ease-in-out infinite;
}

@keyframes pulseYellow {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
    }
    50% {
        box-shadow: 0 8px 24px rgba(255, 193, 7, 0.6);
    }
}

/* ==========================================================================
   Domain Input Enhancements
   ========================================================================== */
#domain {
    transition: all 0.3s ease;
}

#domain:focus {
    transform: scale(1.02);
    box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.15);
}

/* ==========================================================================
   Table Enhancements
   ========================================================================== */
.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(40, 167, 69, 0.05);
    transform: translateX(4px);
}

.table tbody tr td:first-child {
    background: rgba(40, 167, 69, 0.03);
    font-weight: 600;
}

/* Code blocks in table */
.table code {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #0d6efd;
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
}

/* ==========================================================================
   Badge Enhancements
   ========================================================================== */
.badge {
    transition: all 0.2s ease;
    cursor: default;
}

.badge:hover {
    transform: scale(1.08);
}

.badge.bg-primary {
    background: linear-gradient(135deg, #0d6efd 0%, #0dcaf0 100%) !important;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.badge.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.badge.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%) !important;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.3);
    color: #222222 !important;
}

.badge.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%) !important;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.badge.bg-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #0d6efd 100%) !important;
    box-shadow: 0 2px 8px rgba(13, 202, 240, 0.3);
}

/* ==========================================================================
   Action Buttons Section
   ========================================================================== */
.action-buttons .btn {
    position: relative;
    overflow: hidden;
}

.action-buttons .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.action-buttons .btn:hover::before {
    width: 300px;
    height: 300px;
}

.action-buttons .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

.action-buttons .btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.4);
}

.action-buttons .btn-warning:hover {
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4);
}

/* ==========================================================================
   Calendar Link Button Special Style
   ========================================================================== */
.btn-calendar {
    background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%);
    color: #222222;
    font-weight: 700;
    border: none;
}

.btn-calendar:hover {
    background: linear-gradient(135deg, #fd7e14 0%, #ffc107 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.5);
}

/* ==========================================================================
   Loading Overlay Enhancements
   ========================================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    backdrop-filter: blur(4px);
}

.loading-overlay .spinner-border {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Result Container Animation
   ========================================================================== */
.result-container {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.6s ease, max-height 0.6s ease;
}

.result-container.show {
    opacity: 1 !important;
    max-height: 500000px !important;
    overflow: visible !important;
    display: block !important;
}

/* Stagger animation for result cards */
.result-container.show .card {
    animation: slideInUp 0.6s ease forwards;
    opacity: 0;
}

.result-container.show .card:nth-child(1) { animation-delay: 0.1s; }
.result-container.show .card:nth-child(2) { animation-delay: 0.2s; }
.result-container.show .card:nth-child(3) { animation-delay: 0.3s; }
.result-container.show .card:nth-child(4) { animation-delay: 0.4s; }
.result-container.show .card:nth-child(5) { animation-delay: 0.5s; }

/* ==========================================================================
   TLS Version Badges
   ========================================================================== */
.tls-version-badge {
    display: inline-block;
    padding: 8px 16px;
    margin: 4px;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    transition: all 0.3s ease;
}

.tls-version-badge.tls-1-3 {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.tls-version-badge.tls-1-2 {
    background: linear-gradient(135deg, #0d6efd 0%, #0dcaf0 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.tls-version-badge.tls-1-1,
.tls-version-badge.tls-1-0 {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.tls-version-badge:hover {
    transform: translateY(-2px) scale(1.05);
}

/* ==========================================================================
   Security Check Items
   ========================================================================== */
.security-check-item {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

.security-check-item.passed {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 4px solid #28a745;
}

.security-check-item.failed {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-left: 4px solid #dc3545;
}

.security-check-item.warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border-left: 4px solid #ffc107;
}

.security-check-item:hover {
    transform: translateX(6px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.security-check-icon {
    font-size: 32px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.security-check-item:hover .security-check-icon {
    transform: rotate(360deg);
}

/* ==========================================================================
   Certificate Info Table
   ========================================================================== */
.cert-info-table {
    width: 100%;
    border-collapse: collapse;
}

.cert-info-table tr {
    border-bottom: 1px solid #dee2e6;
    transition: all 0.2s ease;
}

.cert-info-table tr:last-child {
    border-bottom: none;
}

.cert-info-table tr:hover {
    background: rgba(40, 167, 69, 0.05);
    transform: translateX(4px);
}

.cert-info-table td {
    padding: 14px 12px;
    vertical-align: top;
}

.cert-info-table td:first-child {
    font-weight: 600;
    color: #495057;
    width: 40%;
    background: rgba(40, 167, 69, 0.03);
}

.cert-info-table td:first-child span {
    margin-right: 8px;
}

/* ==========================================================================
   Days Remaining Counter
   ========================================================================== */
.days-counter {
    display: inline-block;
    font-size: 32px;
    font-weight: 900;
    padding: 8px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1) 0%, rgba(40, 167, 69, 0.05) 100%);
    transition: all 0.3s ease;
}

.days-counter.critical {
    color: #dc3545;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.2) 0%, rgba(220, 53, 69, 0.1) 100%);
    animation: counterPulse 1.5s ease-in-out infinite;
}

.days-counter.warning {
    color: #ffc107;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2) 0%, rgba(255, 193, 7, 0.1) 100%);
}

.days-counter.safe {
    color: #28a745;
}

@keyframes counterPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* ==========================================================================
   Fingerprint Display
   ========================================================================== */
.fingerprint-block {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    background: #2c2c2c;
    color: #00ff00;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    line-height: 1.6;
    word-break: break-all;
}

.fingerprint-label {
    color: #28a745;
    font-weight: 700;
    margin-right: 8px;
}

/* ==========================================================================
   Share Button Special Effect
   ========================================================================== */
.btn-share {
    position: relative;
    overflow: hidden;
}

.btn-share::after {
    content: '📋';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 40px;
    opacity: 0;
    transition: all 0.4s ease;
}

.btn-share:active::after {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 1;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .loading-overlay,
    .btn,
    .accordion,
    .col-lg-4,
    .sidebar {
        display: none !important;
    }
    
    .col-lg-8 {
        width: 100% !important;
    }
    
    .result-container {
        display: block !important;
    }
    
    .card {
        page-break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
    
    .chain-container::before {
        display: none;
    }
    
    .chain-item::before {
        display: none;
    }
    
    /* Print header */
    .result-container::before {
        content: 'SSL Check Report - Generated: ' attr(data-domain);
        display: block;
        padding: 20px;
        background: #f8f9fa;
        border-bottom: 2px solid #28a745;
        margin-bottom: 20px;
        font-weight: 700;
        font-size: 18px;
    }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 991px) {
    .chain-container {
        padding-left: 0;
    }
    
    .chain-container::before {
        display: none;
    }
    
    .chain-item::before {
        display: none;
    }
    
    .security-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .grade-number {
        font-size: 80px !important;
    }
    
    .cert-info-table td:first-child {
        width: 100%;
        display: block;
        background: rgba(40, 167, 69, 0.05);
        padding-bottom: 4px;
    }
    
    .cert-info-table td:last-child {
        width: 100%;
        display: block;
        padding-top: 4px;
    }
    
    .days-counter {
        font-size: 24px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
.btn:focus-visible {
    outline: 3px solid #28a745;
    outline-offset: 2px;
}

input:focus-visible {
    outline: 3px solid #28a745;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #222222 !important;
    }
    
    .badge {
        border: 2px solid currentColor;
    }
    
    .btn {
        border: 2px solid currentColor !important;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .card {
        background: #2c2c2c;
        color: #e5e5e5;
    }
    
    .table {
        color: #e5e5e5;
    }
    
    .table tbody tr:hover {
        background-color: rgba(40, 167, 69, 0.2);
    }
    
    .cert-info-table td:first-child {
        background: rgba(40, 167, 69, 0.1);
    }
    
    .security-check-item.passed {
        background: rgba(40, 167, 69, 0.2);
    }
    
    .security-check-item.failed {
        background: rgba(220, 53, 69, 0.2);
    }
    
    .security-check-item.warning {
        background: rgba(255, 193, 7, 0.2);
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-gradient {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(40, 167, 69, 0.3);
}

.border-gradient {
    border: 2px solid;
    border-image: linear-gradient(135deg, #28a745 0%, #20c997 100%) 1;
}

/* ==========================================================================
   Tooltip Styling
   ========================================================================== */
.tooltip-inner {
    background: #222222;
    color: white;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #222222;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #222222;
}

/* ==========================================================================
   Card Header Icon Animation
   ========================================================================== */
.card-header span {
    display: inline-block;
    transition: transform 0.3s ease;
}

.card:hover .card-header span {
    transform: rotate(5deg) scale(1.1);
}

/* ==========================================================================
   SANs List Styling
   ========================================================================== */
.sans-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.san-badge {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.san-badge:hover {
    transform: scale(1.05);
}

/* ==========================================================================
   Progress Indicators
   ========================================================================== */
.progress-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 900;
    position: relative;
}

.progress-circle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid rgba(40, 167, 69, 0.2);
}

.progress-circle.excellent::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 8px solid #28a745;
    border-bottom-color: transparent;
    transform: rotate(270deg);
}

/* ==========================================================================
   Hover Effects for Interactive Elements
   ========================================================================== */
.interactive-card {
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ==========================================================================
   Status Indicators with Animation
   ========================================================================== */
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    position: relative;
}

.status-dot.active {
    background: #28a745;
    box-shadow: 0 0 0 0 rgba(40, 167, 69, 1);
    animation: statusPulse 2s infinite;
}

.status-dot.inactive {
    background: #dc3545;
}

@keyframes statusPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* ==========================================================================
   Skeleton Loading State (Optional)
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ==========================================================================
   Confetti Effect for A+ Grade (Optional)
   ========================================================================== */
.grade-a-plus-container {
    position: relative;
}

.grade-a-plus-container::after {
    content: '🎉';
    position: absolute;
    top: -20px;
    right: -20px;
    font-size: 40px;
    animation: confetti 3s ease-in-out infinite;
}

@keyframes confetti {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}