/**
 * P-CAPTCHA Styles
 * Complete styling for the P-CAPTCHA widget
 */

/* Base Container */
.p-captcha-container {
    border: 2px solid #6d4aff;
    border-radius: 12px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    box-shadow: 0 8px 32px rgba(109, 74, 255, 0.3);
    padding: 20px;
    margin: 20px 0;
    max-width: 500px;
    position: relative;
    overflow: hidden;
}

/* Light Theme */
.p-captcha-container[data-theme="light"] {
    background: white;
    color: #333;
    border-color: #ddd;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Header */
.p-captcha-header {
    text-align: center;
    margin-bottom: 20px;
}

.p-captcha-title {
    color: #6d4aff;
    font-size: 1.2em;
    font-weight: bold;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.p-captcha-instructions {
    font-size: 0.9em;
    color: #ccc;
    margin: 0;
    line-height: 1.4;
}

.p-captcha-container[data-theme="light"] .p-captcha-instructions {
    color: #666;
}

/* Challenge Container */
.p-captcha-challenge {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    min-height: 200px;
    backdrop-filter: blur(10px);
    position: relative;
}

.p-captcha-container[data-theme="light"] .p-captcha-challenge {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    backdrop-filter: none;
}

/* Loading State */
.p-captcha-loading {
    text-align: center;
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.p-captcha-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #6d4aff;
    border-radius: 50%;
    animation: p-captcha-spin 1s linear infinite;
    margin-bottom: 15px;
}

.p-captcha-container[data-theme="light"] .p-captcha-spinner {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #6d4aff;
}

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

/* Controls */
.p-captcha-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

.p-captcha-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.p-captcha-btn-primary {
    background: #6d4aff;
    color: white;
    box-shadow: 0 2px 8px rgba(109, 74, 255, 0.3);
}

.p-captcha-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid #6d4aff;
}

.p-captcha-container[data-theme="light"] .p-captcha-btn-secondary {
    background: #f8f9fa;
    color: #333;
    border-color: #ddd;
}

.p-captcha-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(109, 74, 255, 0.4);
}

.p-captcha-btn:active:not(:disabled) {
    transform: translateY(0);
}

.p-captcha-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Status Messages */
.p-captcha-status {
    margin-top: 15px;
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    font-size: 0.9em;
    display: none;
    animation: p-captcha-fade-in 0.3s ease;
}

.p-captcha-status.success {
    background: #00b894;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 184, 148, 0.3);
}

.p-captcha-status.error {
    background: #d63031;
    color: white;
    box-shadow: 0 2px 8px rgba(214, 48, 49, 0.3);
}

.p-captcha-status.info {
    background: #0984e3;
    color: white;
    box-shadow: 0 2px 8px rgba(9, 132, 227, 0.3);
}

.p-captcha-status.show {
    display: block;
}

@keyframes p-captcha-fade-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Beam Alignment Styles */
.beam-canvas {
    width: 100%;
    height: 300px;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a1a 100%);
    border: 2px solid #333;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    cursor: crosshair;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.p-captcha-container[data-theme="light"] .beam-canvas {
    background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%);
    border-color: #ccc;
}

.beam-source, .beam-target {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    transition: all 0.2s ease;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.beam-source {
    background: radial-gradient(circle at 30% 30%, #ff6b6b 0%, #ee5a52 100%);
    box-shadow: 0 0 20px #ff6b6b, 0 0 0 2px rgba(255, 255, 255, 0.3);
    cursor: grab;
    z-index: 10;
}

.beam-source:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px #ff6b6b, 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.beam-source:active {
    cursor: grabbing;
    transform: scale(0.95);
}

.beam-target {
    background: radial-gradient(circle at 30% 30%, #4ecdc4 0%, #44a08d 100%);
    box-shadow: 0 0 20px #4ecdc4, 0 0 0 2px rgba(255, 255, 255, 0.3);
    animation: p-captcha-pulse 2s infinite;
}

@keyframes p-captcha-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

.beam-line {
    position: absolute;
    height: 3px;
    background: linear-gradient(90deg, #ff6b6b 0%, rgba(255, 107, 107, 0.8) 50%, #4ecdc4 100%);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.6);
    transform-origin: left center;
    transition: all 0.1s ease;
    border-radius: 2px;
    z-index: 5;
}

/* Sequence Styles */
.sequence-display {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
    font-size: 1.8em;
    font-weight: bold;
    flex-wrap: wrap;
}

.sequence-number {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    min-width: 60px;
    text-align: center;
    border: 2px solid rgba(109, 74, 255, 0.3);
    position: relative;
    transition: all 0.3s ease;
}

.sequence-number:last-child {
    background: rgba(109, 74, 255, 0.3);
    border-color: #6d4aff;
    animation: p-captcha-glow 2s infinite;
}

@keyframes p-captcha-glow {
    0%, 100% { box-shadow: 0 0 10px rgba(109, 74, 255, 0.3); }
    50% { box-shadow: 0 0 20px rgba(109, 74, 255, 0.6); }
}

.sequence-choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 25px;
}

.sequence-choice {
    padding: 18px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(109, 74, 255, 0.3);
    border-radius: 12px;
    text-align: center;
    font-size: 1.4em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.sequence-choice:hover {
    background: rgba(109, 74, 255, 0.2);
    transform: translateY(-3px);
    border-color: #6d4aff;
    box-shadow: 0 4px 12px rgba(109, 74, 255, 0.3);
}

.sequence-choice.selected {
    background: #6d4aff;
    border-color: #5a3de0;
    color: white;
    box-shadow: 0 0 20px rgba(109, 74, 255, 0.5);
    transform: translateY(-3px);
}

/* Responsive Design */
@media (max-width: 480px) {
    .p-captcha-container {
        margin: 15px 0;
        padding: 15px;
    }

    .p-captcha-controls {
        flex-direction: column;
        gap: 10px;
    }

    .p-captcha-btn {
        width: 100%;
    }

    .sequence-display {
        font-size: 1.5em;
        gap: 10px;
    }

    .sequence-choices {
        grid-template-columns: 1fr;
    }

    .beam-canvas {
        height: 250px;
    }

    .beam-source,
    .beam-target {
        width: 25px;
        height: 25px;
    }
}

/* Accessibility */
.p-captcha-btn:focus,
.sequence-choice:focus {
    outline: 2px solid #6d4aff;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .p-captcha-container {
        border-width: 3px;
    }

    .p-captcha-btn,
    .sequence-choice {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .p-captcha-spinner,
    .beam-target {
        animation: none;
    }

    .p-captcha-btn,
    .sequence-choice,
    .beam-source {
        transition: none;
    }
}
