/* Modern PKI Management Demo Styles */
/* Following contemporary UI/UX design principles */

/* ==================== GLOBAL STYLES ==================== */

:root {
    /* Modern Color Palette */
    --primary-color: #2563eb;      /* Calm blue */
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --accent-color: #f97316;       /* Orange accent for CTAs */
    --accent-light: #fb923c;
    --accent-dark: #ea580c;
    --success-color: #059669;
    --warning-color: #d97706;
    --danger-color: #dc2626;
    --info-color: #0891b2;
    
    /* Neutral Colors */
    --bg-primary: #fafafa;         /* Light gray background */
    --bg-secondary: #ffffff;       /* Pure white for cards */
    --bg-tertiary: #f4f4f5;        /* Subtle gray for sections */
    --text-primary: #111827;       /* Dark gray for primary text */
    --text-secondary: #6b7280;     /* Medium gray for secondary text */
    --text-muted: #9ca3af;         /* Light gray for muted text */
    --border-color: #e5e7eb;       /* Light border */
    --border-light: #f3f4f6;       /* Very light border */
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Spacing */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== TYPOGRAPHY ==================== */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1.125rem; }

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted { color: var(--text-muted) !important; }

/* ==================== MODERN NAVIGATION ==================== */

.modern-navbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
}

.brand-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-primary) !important;
    font-weight: 600;
    font-size: 1.25rem;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 12px;
    box-shadow: var(--shadow-sm);
}

.brand-text {
    font-weight: 600;
    letter-spacing: -0.025em;
}

.navbar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    margin: 0 0.25rem;
    transition: all 0.2s ease;
    text-decoration: none;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.1);
    transform: translateY(-1px);
}

.navbar-nav .nav-link i {
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* ==================== MAIN CONTENT LAYOUT ==================== */

.main-content {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

/* ==================== MODERN CARDS ==================== */

.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    overflow: hidden;
}

/* Override overflow for CA hierarchy cards that need dropdown menus */
.ca-hierarchy .card,
.ca-node .card {
    overflow: visible !important;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 2rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* ==================== MODERN BUTTONS ==================== */

.btn {
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    cursor: pointer;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
}

/* Accent/CTA Button */
.btn-success {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--accent-dark), var(--accent-color));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
}

/* Secondary Button */
.btn-secondary,
.btn-outline-secondary {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover,
.btn-outline-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Outline Buttons */
.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger-color);
    border: 1.5px solid var(--danger-color);
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-outline-info {
    background: transparent;
    color: var(--info-color);
    border: 1.5px solid var(--info-color);
}

.btn-outline-info:hover {
    background: var(--info-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-outline-warning {
    background: transparent;
    color: var(--warning-color);
    border: 1.5px solid var(--warning-color);
}

.btn-outline-warning:hover {
    background: var(--warning-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

/* Disabled State */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ==================== MODERN ALERTS ==================== */

.modern-alert {
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.alert-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
    margin-top: 0.125rem;
}

.alert-content {
    flex: 1;
    font-weight: 500;
}

.alert-success {
    background: rgba(5, 150, 105, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: rgba(217, 119, 6, 0.1);
    color: var(--warning-color);
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: rgba(8, 145, 178, 0.1);
    color: var(--info-color);
    border-left: 4px solid var(--info-color);
}

/* ==================== ALGORITHM BADGES (MODERN) ==================== */

.algorithm-badge {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    height: 100%;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.algorithm-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    transition: all 0.2s ease;
}

.algorithm-badge.classical::before {
    background: linear-gradient(180deg, var(--text-secondary), var(--text-muted));
}

.algorithm-badge.pqc::before {
    background: linear-gradient(180deg, var(--warning-color), #fbbf24);
}

.algorithm-badge.hybrid::before {
    background: linear-gradient(180deg, var(--info-color), #0ea5e9);
}

.algorithm-badge.standards::before {
    background: linear-gradient(180deg, var(--success-color), #10b981);
}

.algorithm-badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.algorithm-badge h6 {
    font-weight: 600;
    font-size: 1.125rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.algorithm-badge ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.algorithm-badge li {
    padding: 0.375rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-light);
}

.algorithm-badge li:last-child {
    border-bottom: none;
}

/* ==================== MODERN TABLES ==================== */

.table {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tbody td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-tertiary);
}

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

/* ==================== MODERN BADGES ==================== */

.badge {
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.bg-secondary {
    background: var(--text-secondary) !important;
    color: white;
}

.badge.bg-warning {
    background: var(--warning-color) !important;
    color: white;
}

.badge.bg-info {
    background: var(--info-color) !important;
    color: white;
}

.badge.bg-success {
    background: var(--success-color) !important;
    color: white;
}

.badge.bg-primary {
    background: var(--primary-color) !important;
    color: white;
}

/* ==================== CA HIERARCHY VISUALIZATION ==================== */

.ca-node {
    margin-bottom: 1.5rem;
}

.ca-node .card {
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    /* Allow dropdowns to extend beyond card boundaries */
    overflow: visible;
}

.ca-node .card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ca-node .card-body {
    padding: 1.5rem;
    /* Ensure dropdown parent can extend */
    position: relative;
}

/* Fix dropdown positioning in CA hierarchy */
.ca-node .btn-group .dropdown-menu {
    /* Ensure dropdown appears above other elements */
    z-index: 9999 !important;
    /* Let Bootstrap handle left/right positioning automatically */
    right: auto !important;
    left: auto !important;
    /* Add some margin to prevent touching card edge */
    margin-top: 0.25rem;
    /* Ensure proper positioning relative to button */
    position: absolute !important;
    /* Force minimum height to show all items */
    max-height: none !important;
    /* Ensure no parent constraints */
    transform: none !important;
    /* Prevent dropdown from going off-screen */
    min-width: 160px;
}

/* Add responsive positioning for dropdown based on screen position */
.ca-node .btn-group.dropstart .dropdown-menu {
    right: 100% !important;
    left: auto !important;
    margin-right: 0.25rem;
    margin-top: 0;
}

.ca-node .btn-group.dropend .dropdown-menu {
    left: 100% !important;
    right: auto !important;
    margin-left: 0.25rem;  
    margin-top: 0;
}

/* Fix dropdown positioning in certificate details page */
.col-lg-4 .btn-group .dropdown-menu {
    /* Ensure dropdown appears above other elements */
    z-index: 9999 !important;
    /* Force dropdown to align left (towards center) when in right sidebar */
    right: 0 !important;
    left: auto !important;
    /* Add some margin to prevent touching card edge */
    margin-top: 0.25rem;
    /* Ensure proper positioning relative to button */
    position: absolute !important;
    /* Force minimum height to show all items */
    max-height: none !important;
    /* Ensure no parent constraints */
    transform: none !important;
    /* Prevent dropdown from going off-screen */
    min-width: 160px;
}

/* Alternative positioning for certificate actions when needed */
.certificate-actions .btn-group .dropdown-menu {
    right: 0 !important;
    left: auto !important;
}

/* Fix overflow issues in certificate details cards */
.card.mb-3,
.card {
    overflow: visible !important;
}

.card-body {
    overflow: visible !important;
}

/* Ensure dropdowns in certificate actions display fully */
.card-body .btn-group,
.card-body .dropdown {
    position: relative;
    overflow: visible !important;
}

.card-body .dropdown-menu {
    position: absolute !important;
    z-index: 9999 !important;
    max-height: none !important;
    overflow-y: auto !important;
    max-height: 400px !important; /* Allow scrolling for very long menus */
}

/* Fix CA node button positioning to prevent border overlap */
.ca-node .card-body .col-md-2.text-end {
    padding-right: 1.5rem !important;
    margin-right: 0.5rem !important;
}

.ca-node .btn-group {
    margin-right: 0.75rem !important;
    gap: 0.25rem;
}

.ca-node .btn-group .btn {
    border-width: 1px;
    margin: 0 2px;
    padding: 0.25rem 0.5rem;
}

/* Ensure proper spacing within CA cards */
.ca-node .card-body {
    padding: 1rem 1.5rem 1rem 1.25rem !important;
}

/* Additional spacing for the action buttons column */
.ca-node .card-body .row .col-md-2:last-child {
    max-width: 18% !important;
    padding-left: 0.5rem !important;
}

/* Ensure any section containing CA hierarchy allows overflow */
.section-container:has(.ca-hierarchy) {
    overflow: visible !important;
}

.ca-hierarchy {
    overflow: visible !important;
}

/* Combined dropdown menu styling and positioning for CA sections */
.ca-node .dropdown-menu {
    /* Ensure dropdown doesn't get constrained */
    position: absolute !important;
    z-index: 9999 !important;
    /* Styling */
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    background: var(--bg-secondary);
    min-width: 200px;
    /* Force no height constraints */
    max-height: none !important;
    /* Only show when dropdown is actually shown */
    display: none;
}

.ca-node .dropdown-menu.show {
    display: block !important;
}

.ca-node .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: background-color 0.15s ease;
}

.ca-node .dropdown-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Modern hierarchy indicators */
.ca-node .border-primary { border-left: 4px solid var(--primary-color) !important; }
.ca-node .border-warning { border-left: 4px solid var(--warning-color) !important; }
.ca-node .border-info { border-left: 4px solid var(--info-color) !important; }

/* ==================== FORMS ==================== */

.form-control,
.form-select {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--bg-secondary);
}

.form-label {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
}

.form-section h6 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==================== MODERN FOOTER ==================== */

.modern-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: 4rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.125rem;
}

.footer-brand i {
    color: var(--primary-color);
    font-size: 1.25rem;
}

.footer-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.footer-description small {
    color: var(--text-muted);
}

/* ==================== STATISTICS CARDS ==================== */

.card.bg-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light)) !important;
    border: none;
    color: white;
}

.card.bg-success {
    background: linear-gradient(135deg, var(--success-color), #10b981) !important;
    border: none;
    color: white;
}

.card.bg-info {
    background: linear-gradient(135deg, var(--info-color), #0ea5e9) !important;
    border: none;
    color: white;
}

/* ==================== DROPDOWN FIXES ==================== */

/* NUCLEAR OPTION: Override ALL Bootstrap dropdown behavior */
.dropdown-menu[data-bs-popper],
.dropdown-menu.show,
.dropdown-menu,
ul.dropdown-menu,
.btn-group > .dropdown-menu,
.card-body .btn-group .dropdown-menu {
    position: absolute !important;
    height: 280px !important; /* Fixed height instead of max-height */
    max-height: none !important; /* Remove max-height */
    min-height: auto !important;
    overflow-y: auto !important; /* Try auto instead of scroll */
    overflow-x: hidden !important;
    overflow: auto !important; /* Additional fallback */
    min-width: 250px !important;
    z-index: 9999 !important;
    transform: none !important;
    inset: auto auto auto 0px !important;
    margin: 0px !important;
    border: 3px solid #ff0000 !important; /* RED DEBUG BORDER */
    background: white !important;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important;
    /* Force scroll container */
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
}

/* Force all dropdown items to be visible */
.dropdown-item,
li > .dropdown-item,
.dropdown-menu .dropdown-item {
    display: block !important;
    padding: 8px 16px !important;
    font-size: 14px !important;
    white-space: nowrap !important;
    border-bottom: 1px solid #eee !important;
    color: #333 !important;
}

/* Ensure dropdown shows on click */
.btn-group.show .dropdown-menu,
.dropdown.show .dropdown-menu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Force positioning */
.card-body .btn-group {
    position: relative !important;
}

/* Make scroll behavior visible */
.dropdown-menu::-webkit-scrollbar {
    width: 12px !important;
    background: #f0f0f0 !important;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: #888 !important;
    border-radius: 6px !important;
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #555 !important;
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }
    
    .card-body {
        padding: 1.5rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }
    
    /* Make dropdowns full width on mobile */
    .dropdown-menu {
        width: 100%;
        max-height: 300px;
    }
    
    .btn-group .btn {
        border-radius: var(--border-radius-sm);
        margin-bottom: 0.25rem;
    }
    
    .navbar-nav .nav-link {
        padding: 1rem;
        margin: 0.25rem 0;
    }
    
    .algorithm-badge {
        margin-bottom: 1.5rem;
    }
    
    .table-responsive {
        border-radius: var(--border-radius);
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
}

/* ==================== LOADING STATES ==================== */

.btn.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1rem;
    height: 1rem;
    margin: -0.5rem 0 0 -0.5rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ==================== ACCESSIBILITY ==================== */

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

/* Focus indicators */
.btn:focus,
.form-control:focus,
.form-select:focus,
.nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-secondary: #000000;
    }
    
    .card,
    .algorithm-badge {
        border-width: 2px;
    }
}

/* Print styles */
@media print {
    .navbar,
    .btn,
    .footer {
        display: none !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}

/* ==================== AWS REKOGNITION LIVENESS STYLES ==================== */

/* Challenge Options Styling */
.challenge-option .btn-check:checked + .btn {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.challenge-config .btn {
    transition: all 0.2s ease;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.challenge-config .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ColorSequence Technology Info Styling */
.colorsequence-info .card {
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid var(--border-color);
}

.colorsequence-info .card-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 1rem;
}

.protection-point {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6px;
    padding: 2px 0;
}

.protection-point i {
    margin-top: 2px;
    flex-shrink: 0;
}

.protection-point small {
    line-height: 1.3;
    color: var(--text-primary);
    font-weight: 500;
}

.colorsequence-info .card-body {
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.colorsequence-info .card-text {
    line-height: 1.4;
    color: var(--text-secondary);
}

/* AWS Liveness Card Styling */
.aws-liveness-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.aws-liveness-card .card-header {
    background: linear-gradient(135deg, #ff9900 0%, #ff6600 100%);
    color: white;
    border-bottom: none;
    padding: 1.5rem;
}

.aws-liveness-card .card-header h4 {
    color: white;
    margin: 0;
    font-weight: 600;
}

.aws-liveness-card .card-header p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 0.9rem;
}

/* Feature List Styling */
.feature-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: rgba(37, 99, 235, 0.05);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--border-color);
    transition: all 0.2s ease;
}

.feature-item:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: translateX(4px);
}

.feature-item i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.feature-item span {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* AWS FaceLivenessDetector Component Fixes - Architect Recommended Solution */
.aws-detector-container {
    position: relative;
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
}

/* Force the minimal layout contract as recommended by architect */
[data-amplify-liveness] .amplify-liveness-detector__camera {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
}

[data-amplify-liveness] video {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    position: relative !important;
    z-index: 1 !important;
}

[data-amplify-liveness] .amplify-liveness-detector__overlay,
[data-amplify-liveness] canvas {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    pointer-events: none !important;
    width: 100% !important;
    height: 100% !important;
    top: 0 !important;
    left: 0 !important;
}

/* Safari-specific GPU composition fix */
[data-amplify-liveness] .amplify-liveness-detector__overlay,
[data-amplify-liveness] canvas {
    -webkit-transform: translateZ(0) !important;
    transform: translateZ(0) !important;
    will-change: transform !important;
}

/* Ensure proper container structure */
[data-amplify-liveness] {
    position: relative !important;
}

/* Fallback selectors for any overlay elements */
[data-amplify-liveness] svg {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    pointer-events: none !important;
    width: 100% !important;
    height: 100% !important;
}

/* Safari-specific fixes for WebKit video layering issues */
/* ==================== AWS AMPLIFY FACE LIVENESS OVERLAY FIXES ==================== */

/* AWS Amplify Face Liveness overlay positioning fixes - all browsers */
#react-aws-liveness-mount {
    position: relative !important;
    isolation: isolate !important;
    overflow: hidden !important;
    border-radius: 16px !important;
}

#react-aws-liveness-mount video {
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    height: auto !important;
    display: block !important;
}

#react-aws-liveness-mount canvas,
#react-aws-liveness-mount svg {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    pointer-events: none !important;
}

/* Additional overlay selectors for robustness */
#react-aws-liveness-mount [class*="overlay"],
#react-aws-liveness-mount [data-testid*="overlay"] {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    pointer-events: none !important;
}

/* Let AWS handle the overlay design correctly - no custom background/blur effects */

/* Responsive enhancements for ColorSequence */
@media (max-width: 768px) {
    .colorsequence-info .card-body {
        padding: 1rem;
    }
    
    .protection-point {
        margin-bottom: 8px;
    }
    
    .challenge-config .btn {
        min-height: 70px;
        font-size: 0.875rem;
    }
    
    .aws-detector-container {
        max-width: 100%;
    }
}