/**
 * Card Interface - Specific styles
 * Moved from inline styles to external file for better caching
 */

/* Theme and color variables with improved contrast for accessibility */
:root {
    --primary-color: #3a7bd5;
    --primary-color-rgb: 58, 123, 213;
    --text-color: #333;
    --text-muted: #666;
    --border-color: #ddd;
    --card-bg: #fff;
    /* Suit palette */
    --spades-color: #F4D03F;
    --hearts-color: #2ECC71;
    --clubs-color: #3498DB;
    --diamonds-color: #E74C3C;
    
    /* Animation timing */
    --transition-speed: 0.3s;
    
    /* Visualization scaling */
    --visualization-scale: 1;
    
    /* Accessibility */
    --focus-ring-color: #4d90fe;
    --focus-ring-width: 3px;
}

/* Dark theme variables with improved contrast */
[data-theme="dark"] {
    --primary-color: #4facfe;
    --primary-color-rgb: 79, 172, 254;
    --text-color: #f0f0f0;
    --text-muted: #b0b0b0;
    --border-color: #444;
    --card-bg: #222;
    --spades-color: #F7DC6F;
    --hearts-color: #58D68D;
    --clubs-color: #5DADE2;
    --diamonds-color: #EC7063;
    
    /* Dark mode focus ring */
    --focus-ring-color: #7ab3ff;
}

/* Base responsive font size adjustments */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 12px;
    }
}

/* Improved focus styles for accessibility */
button:focus,
input:focus,
select:focus,
a:focus {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: 2px;
}

/* Skip navigation for keyboard users */
.skip-nav {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    z-index: 1000;
    transition: top 0.3s;
}

.skip-nav:focus {
    top: 0;
}

/* Password progress indicators */
.password-progress {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.password-indicator {
    width: 40px;
    height: 40px;
    border: 2px dashed var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all var(--transition-speed) ease;
}

.password-indicator.active {
    border-style: solid;
    border-color: var(--primary-color);
    animation: pulse 1.5s infinite;
}

.password-indicator.completed {
    border-style: solid;
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-color-rgb), 0.1);
}

/* Improved mobile responsive indicators */
@media (max-width: 480px) {
    .password-progress {
        gap: 6px;
    }
    
    .password-indicator {
        width: 32px;
        height: 32px;
    }
}

/* Suit selectors with improved touch targets */
.selected-suit {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: 'Inter', 'Segoe UI Symbol', 'Helvetica Neue', 'Arial Unicode MS', 'Apple Symbols', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-variant-emoji: text;
}

.selected-suit.spades {
    color: var(--spades-color);
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

.selected-suit.hearts {
    color: var(--hearts-color);
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

.selected-suit.clubs {
    color: var(--clubs-color);
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

.selected-suit.diamonds {
    color: var(--diamonds-color);
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}

.selection-instructions {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.password-entry-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap; /* allow wrapping on narrow screens */
    white-space: normal;
    overflow: visible;
    padding: 0.25rem 0.5rem;
    width: 100%;
}

.password-entry-header h2,
.password-entry-header .selection-instructions,
.password-entry-divider {
    display: inline-flex;
    align-items: center;
    margin: 0;
    white-space: nowrap;
    flex: 0 0 auto;
    line-height: 1.2;
}

.password-entry-header .selection-instructions {
    color: var(--text-muted);
}

.password-entry-divider {
    color: var(--text-muted);
}

@media (max-width: 640px) {
    .password-entry-header {
        justify-content: flex-start;
        gap: 0.35rem;
        padding: 0.2rem 0.35rem;
    }
    
    .password-entry-header h2 {
        font-size: 1.25rem;
    }
    
    .password-entry-header .selection-instructions {
        font-size: 0.95rem;
    }
    
    .password-entry-divider {
        font-size: 1.05rem;
    }
}

/* Character text styling for visualization with better visibility */
.char-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-weight: bold;
    /* Simplified text-shadow with better contrast */
    text-shadow: 
        0px 0px 2px rgba(0, 0, 0, 0.8),
        0px 0px 1px rgba(255, 255, 255, 0.8);
    font-size: calc(1.2rem * var(--visualization-scale));
    transition: all 0.3s ease;
    paint-order: normal;
    stroke: none;
    stroke-width: 0;
    stroke-linejoin: round;
    letter-spacing: -0.5px;
    dominant-baseline: central;
    /* Reduced animation for better readability */
    animation: float-in 0.6s ease-out;
    pointer-events: none; /* Do not capture clicks/taps */
}

/* Remove the excessive glow animation */
@keyframes pulse-glow {
    0% { filter: none; }
    100% { filter: none; }
}

/* Enhanced dark mode character visibility */
[data-theme="dark"] .char-text {
    /* Increased contrast for dark mode */
    text-shadow: 
        0px 0px 3px rgba(255, 255, 255, 1.0),
        0px 0px 5px rgba(255, 255, 255, 0.8);
    stroke: rgba(0, 0, 0, 0.8);
    stroke-width: 3px;
    filter: brightness(1.2) contrast(1.2);
}

[data-theme="dark"] .char-♠, 
[data-theme="dark"] .char-spades {
    filter: drop-shadow(0 0 3px rgba(244, 208, 63, 0.5));
}

[data-theme="dark"] .char-♥, 
[data-theme="dark"] .char-hearts {
    filter: drop-shadow(0 0 3px rgba(46, 204, 113, 0.5));
}

[data-theme="dark"] .char-♦, 
[data-theme="dark"] .char-diamonds {
    filter: drop-shadow(0 0 3px rgba(231, 76, 60, 0.5));
}

[data-theme="dark"] .char-♣, 
[data-theme="dark"] .char-clubs {
    filter: drop-shadow(0 0 3px rgba(52, 152, 219, 0.5));
}

/* Visualization point with enhanced visibility */
.visualization-svg .point {
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.5));
}

/* Suit buttons with improved touch targets */
.suit-btn {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: all var(--transition-speed) ease;
    min-width: 70px;
    min-height: 70px;
}

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

.suit-btn:focus {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: 2px;
}

.suit-btn[aria-pressed="true"], .suit-btn.selected {
    background-color: rgba(var(--primary-color-rgb), 0.1);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.suit-selection {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Mobile-responsive suit buttons */
@media (max-width: 480px) {
    .suit-selection {
        gap: 0.5rem;
        justify-content: flex-start;
    }
    
    .suit-btn {
        padding: 0.8rem;
        min-width: 60px;
        min-height: 60px;
    }
}

/* Visualization section with responsive height - IMPROVED */
.visualization-section {
    height: clamp(420px, 60vh, 680px); /* Larger vertical space to avoid clipping text */
    display: flex;
    flex-direction: column;
    transition: height 0.3s ease;
    margin: 1rem 0; /* Added margin for spacing */
    position: relative; /* Added for child positioning */
    z-index: 1; /* Ensure proper stacking */
}

@media (max-width: 768px) {
    .visualization-section {
        height: clamp(360px, 55vh, 520px); /* INCREASED mobile height */
    }
}

@media (max-width: 480px) {
    .visualization {
        min-height: 320px;
    }
}

.visualization {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background-color: rgba(var(--primary-color-rgb), 0.05);
    overflow: hidden;
    width: 100%; /* Ensure full width */
    height: 100%; /* Ensure full height */
    min-height: 300px; /* Minimum height for content */
}

/* IMPORTANT: SVG container must be fully visible */
.visualization svg {
    width: 100% !important;
    height: 100% !important;
    display: block; /* Prevent whitespace issues */
    transform-origin: center; /* For animations */
}

/* Improved loading state with more visible indicators */
.visualization.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background-color: rgba(var(--primary-color-rgb), 0.08); /* Slightly darker background when loading */
}

.visualization .loader {
    width: 50px; /* Larger loader */
    height: 50px;
    border: 4px solid rgba(var(--primary-color-rgb), 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s linear infinite;
}

.visualization .message {
    color: var(--text-color);
    font-weight: 500;
    text-align: center;
    max-width: 80%;
}

/* Hyperplane styles with better visibility */
.hyperplane.active {
    stroke-width: max(3px, calc(3px * var(--visualization-scale)));
    stroke-dasharray: none;
    opacity: 1;
}

/* IMPROVED character text styling for better visibility */
.char-text {
    font-family: 'Inter', sans-serif;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    pointer-events: none; /* Let taps/clicks hit the color region behind */
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.char-text:hover {
    transform: scale(1.2);
    cursor: default;
}

/* Character backgrounds for better contrast */
.char-bg {
    opacity: 0;
    stroke-width: 0;
    fill: none;
    pointer-events: none;
    filter: none;
}

/* Dark theme specific adjustments */
[data-theme="dark"] .char-text {
    fill: white;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Animation keyframes for visualization elements */
@keyframes pulse-glow {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Möbius path with increased visibility */
.mobius-path {
    stroke-width: 2.5px !important;
    opacity: 0.9 !important;
}

/* Make the background gradient more visible */
.background-circle {
    opacity: 0.8 !important;
}

/* Improved quadrant visibility */
.outer-quadrant, .inner-quadrant {
    opacity: 1;
    transition: opacity 0.3s ease, fill 0.3s ease;
}

.outer-quadrant:hover, .inner-quadrant:hover {
    opacity: 1;
}

/* Improved focus handling for buttons */
button:not([disabled]):focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: 2px;
}

/* Screen reader utilities */
.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;
}

/* Animation keyframes */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(var(--primary-color-rgb), 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(var(--primary-color-rgb), 0); }
    100% { box-shadow: 0 0 0 0 rgba(var(--primary-color-rgb), 0); }
}

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

/* Improved verification button states */
.action-button {
    transition: all var(--transition-speed) ease;
    position: relative;
    overflow: hidden;
}

.action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.action-button:not(:disabled):hover {
    transform: translateY(-2px);
}

.action-button:not(:disabled):active {
    transform: translateY(1px);
}

/* Progress bar animation improvements */
.progress-container {
    height: 4px;
    background-color: rgba(var(--primary-color-rgb), 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0.5rem 0 0.25rem;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.3s ease-out;
}

/* Status message improvements */
.status-message {
    margin: 0;
    padding: 0.75rem 0.5rem;
    border-radius: 6px;
    text-align: center;
    transition: all var(--transition-speed) ease;
    line-height: 1.4;
    background: var(--card-bg);
    position: relative;
    z-index: 1;
}

.status-message.error {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.status-message.success {
    background-color: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

/* Responsive media queries */
@media (prefers-reduced-motion) {
    * {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* Admin panel styles */
.mapping-table {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.mapping-table div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    background-color: var(--card-bg);
    color: var(--text-color);
}

/* Counter styles */
.counters-section {
    margin: 3rem auto 2rem;
}

.section-title {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.8rem;
}

.counter-flex {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.counter-card {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.attempts-counter {
    background-color: var(--primary-color, #3a7bd5);
}

.bitcoin-counter {
    background-color: #f7931a; /* Bitcoin orange */
}

.counter-value {
    font-weight: bold;
    font-size: 1.2rem;
}

/* Bitcoin specific elements */
.btc-symbol {
    font-weight: bold;
    margin-left: 3px;
}

.usd-value {
    color: rgba(255, 255, 255, 0.9);
    transition: color 0.3s ease;
}

.usd-value:hover {
    color: white;
    text-decoration: underline;
}

/* Counter responsive styles */
@media (max-width: 640px) {
    .counter-flex {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .counter-card {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

/* Success/error states for password indicators */
.password-indicator.success {
    border-color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
    animation: success-pulse 1.5s 1;
}

.password-indicator.error {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
    animation: error-pulse 1.5s 1;
}

/* Expected tooltip for admin mode */
.expected-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: 10;
    margin-top: 5px;
    pointer-events: none;
}

/* Success & error animations */
@keyframes success-pulse {
    0% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(40, 167, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(40, 167, 69, 0); }
}

@keyframes error-pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* Notification enhancements */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: white;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    max-width: 90%;
    width: 400px;
    text-align: center;
}

.notification.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.notification.success {
    border-left: 4px solid var(--success-color, #28a745);
}

.notification.error {
    border-left: 4px solid var(--error-color, #dc3545);
}

.notification h3 {
    margin-top: 0;
    margin-bottom: 5px;
    color: var(--text-color);
}

.notification p {
    margin: 0;
    color: var(--text-muted);
}

.notification i {
    font-size: 24px;
    margin-right: 10px;
}

.notification .success-icon {
    color: var(--success-color, #28a745);
}

.notification .error-icon {
    color: var(--error-color, #dc3545);
}

/* Visualization enhancements for animation */
.visualization-svg .point {
    transition: opacity 0.2s ease;
}

.visualization-svg .active-point {
    filter: drop-shadow(0 0 6px rgba(var(--primary-color-rgb), 0.8));
}

/* Custom animation for character placement */
@keyframes float-in {
    0% { 
        opacity: 0;
        transform: translateY(5px) scale(0.9);
    }
    100% { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.char-text {
    animation: float-in 0.6s ease-out;
}

/* Add more distinct background for characters to make them readable */
.char-bg {
    filter: blur(0.5px);
    opacity: 0.7;
    transition: all 0.3s ease;
}

/* Mobile visualization improvements */
@media (max-width: 480px) {
    .visualization-section {
        height: 300px; /* Fixed height for small screens */
        margin: 0.5rem 0;
    }
    
    .hyperplane-label {
        font-size: 12px !important;
    }
    
    .mobius-path {
        stroke-width: 1.5px !important;
    }
    
    .char-text {
        font-size: 12px !important;
    }
    
    .char-bg {
        r: 9px !important;
    }
} 
