/**
 * AI Story Generator Security Styles
 *
 * Styles for security components including CAPTCHA modals,
 * rate limit notifications, and security indicators.
 */

/* CAPTCHA Modal Styles */
.ai-story-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-in-out;
}

.ai-story-modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 30px;
    border: 1px solid #ddd;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-in-out;
}

.ai-story-modal-content h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.4em;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.ai-story-modal-content p {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #555;
}

/* CAPTCHA Form Styles */
#ai-story-captcha-form {
    margin: 0;
}

#ai-story-captcha-form input[type="number"],
#ai-story-captcha-form input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1.1em;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

#ai-story-captcha-form input[type="number"]:focus,
#ai-story-captcha-form input[type="text"]:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 5px rgba(0, 124, 186, 0.3);
}

/* Radio Button Styles for Image CAPTCHA */
.captcha-image label {
    display: block;
    margin: 10px 0;
    padding: 10px;
    background-color: #f9f9f9;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.captcha-image label:hover {
    background-color: #f0f0f0;
    border-color: #007cba;
}

.captcha-image input[type="radio"] {
    margin-right: 10px;
}

.captcha-image label input[type="radio"]:checked + span,
.captcha-image label:has(input[type="radio"]:checked) {
    background-color: #e6f3ff;
    border-color: #007cba;
    font-weight: bold;
}

/* Button Styles */
#ai-story-captcha-form button {
    background-color: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    margin-right: 10px;
    transition: background-color 0.3s ease;
}

#ai-story-captcha-form button:hover {
    background-color: #005a87;
}

#captcha-cancel {
    background-color: #666 !important;
}

#captcha-cancel:hover {
    background-color: #444 !important;
}

/* reCAPTCHA Container */
.g-recaptcha {
    margin: 15px 0;
    display: flex;
    justify-content: center;
}

/* Security Notifications */
.ai-story-security-notice {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-left: 4px solid #f39c12;
    color: #856404;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
}

.ai-story-security-notice.error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    border-left-color: #dc3545;
    color: #721c24;
}

.ai-story-security-notice.success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    border-left-color: #28a745;
    color: #155724;
}

.ai-story-security-notice .notice-title {
    font-weight: bold;
    margin-bottom: 5px;
}

/* Rate Limit Indicator */
.ai-story-rate-limit-indicator {
    background-color: #e9ecef;
    border-radius: 20px;
    height: 8px;
    margin: 10px 0;
    overflow: hidden;
}

.ai-story-rate-limit-bar {
    background: linear-gradient(90deg, #28a745 0%, #ffc107 50%, #dc3545 100%);
    height: 100%;
    transition: width 0.3s ease;
}

.ai-story-rate-limit-text {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

/* Security Badge */
.ai-story-security-badge {
    display: inline-flex;
    align-items: center;
    background-color: #e6f3ff;
    border: 1px solid #007cba;
    border-radius: 15px;
    padding: 5px 12px;
    font-size: 0.9em;
    color: #007cba;
    margin: 5px 0;
}

.ai-story-security-badge::before {
    content: "🔒";
    margin-right: 5px;
}

/* Honeypot Fields (Hidden) */
.ai-story-honeypot {
    position: absolute !important;
    left: -9999px !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

/* Loading States */
.ai-story-security-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.ai-story-security-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

/* Security Dashboard Styles (Admin) */
.ai-story-security-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.ai-story-security-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-story-security-card h3 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
}

.ai-story-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.ai-story-metric:last-child {
    border-bottom: none;
}

.ai-story-metric-value {
    font-weight: bold;
    color: #007cba;
}

.ai-story-metric-trend {
    font-size: 0.9em;
    color: #666;
}

.ai-story-metric-trend.up {
    color: #dc3545;
}

.ai-story-metric-trend.down {
    color: #28a745;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-story-modal-content {
        margin: 5% auto;
        width: 95%;
        padding: 20px;
    }
    
    .ai-story-security-dashboard {
        grid-template-columns: 1fr;
    }
    
    #ai-story-captcha-form button {
        width: 100%;
        margin: 5px 0;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .ai-story-modal-content {
        border: 3px solid #000;
    }
    
    .ai-story-security-notice {
        border-width: 2px;
    }
    
    #ai-story-captcha-form input[type="number"],
    #ai-story-captcha-form input[type="text"] {
        border-width: 2px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ai-story-modal-content {
        background-color: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .ai-story-modal-content h3 {
        color: #e2e8f0;
        border-bottom-color: #4299e1;
    }
    
    #ai-story-captcha-form input[type="number"],
    #ai-story-captcha-form input[type="text"] {
        background-color: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .captcha-image label {
        background-color: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .ai-story-security-card {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
}