/**
 * Candidate Rating Styles
 * Styles for the animated R button and rating modal
 */

/* ===== RATING CTA BUTTON ===== */
.rating-cta-button {
    position: fixed;
    top: 160px; /* Position below the S button */
    left: 16px; /* LEFT side, not right! */
    width: 48px;
    height: 48px;
    background: #f97316;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
    transition: all 0.3s ease;
    animation: gentleBounce 2s infinite;
}

.rating-cta-button:hover {
    background: #ea580c;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.4);
    animation: glowPulse 1s infinite;
}

.rating-cta-button:focus {
    outline: 2px solid #f97316;
    outline-offset: 2px;
}

.rating-cta-button:active {
    transform: scale(0.95);
}

/* Ring pulse animation */
.rating-cta-button::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: transparent;
    animation: pulseRing 3s infinite;
    pointer-events: none;
}

/* ===== ANIMATIONS ===== */
@keyframes gentleBounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) scale(1);
    }
    40% {
        transform: translateY(-8px) scale(1.05);
    }
    60% {
        transform: translateY(-4px) scale(1.02);
    }
}

@keyframes pulseRing {
    0% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(249, 115, 22, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(249, 115, 22, 0);
    }
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(249, 115, 22, 0.5), 0 0 10px rgba(249, 115, 22, 0.3);
    }
    50% {
        box-shadow: 0 0 10px rgba(249, 115, 22, 0.8), 0 0 20px rgba(249, 115, 22, 0.5);
    }
}

/* ===== MODAL STYLES ===== */
.rating-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 16px;
}

.rating-modal.active {
    opacity: 1;
    visibility: visible;
}

.rating-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.rating-modal.active .rating-modal-content {
    transform: scale(1) translateY(0);
}

/* ===== MODAL HEADER ===== */
.rating-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.rating-modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.rating-modal-close {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rating-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

/* ===== MODAL BODY ===== */
.rating-modal-body {
    padding: 24px;
}

.rating-section {
    margin-bottom: 32px;
}

.rating-section:last-child {
    margin-bottom: 0;
}

.rating-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 16px 0;
    text-align: center;
}

.rating-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px 0;
}

.rating-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 12px;
}

/* ===== STAR RATING ===== */
.star-rating {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 16px;
}

.star-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.star-button:hover {
    transform: scale(1.1);
}

.star-button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.star-button i {
    font-size: 32px;
    color: #d1d5db;
    transition: color 0.2s ease;
}

.star-button.active i,
.star-button:hover i {
    color: #fbbf24;
}

.rating-feedback {
    text-align: center;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    min-height: 20px;
}

/* ===== RECOMMENDATION BUTTONS ===== */
.recommendation-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.recommend-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    background: white;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.recommend-button:hover {
    border-color: #9ca3af;
    color: #374151;
}

.recommend-button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.recommend-button[data-recommend="1"].active {
    border-color: #10b981;
    background: #ecfdf5;
    color: #047857;
}

.recommend-button[data-recommend="0"].active {
    border-color: #ef4444;
    background: #fef2f2;
    color: #dc2626;
}

/* ===== FEEDBACK TEXTAREA ===== */
.rating-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.2s ease;
}

.rating-section textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.character-count {
    text-align: right;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

/* ===== MODAL FOOTER ===== */
.rating-modal-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px 24px;
    border-top: 1px solid #e5e7eb;
}

.rating-modal-footer button {
    flex: 1;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-cancel {
    background: white;
    color: #6b7280;
    border-color: #d1d5db;
}

.btn-cancel:hover {
    background: #f9fafb;
    color: #374151;
}

.btn-submit {
    background: #3b82f6;
    color: white;
}

.btn-submit:hover:not(:disabled) {
    background: #2563eb;
}

.btn-submit:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-submit:focus,
.btn-cancel:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ===== SUCCESS MESSAGE ===== */
.success-message {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 48px;
    color: #10b981;
    margin-bottom: 16px;
}

.success-message h3 {
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.success-message p {
    font-size: 16px;
    color: #6b7280;
    margin: 0;
}

/* ===== ERROR MESSAGE ===== */
.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
    margin-bottom: 16px;
}

.error-message i {
    flex-shrink: 0;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .rating-modal {
        padding: 8px;
    }
    
    .rating-modal-content {
        max-height: 95vh;
    }
    
    .rating-modal-header,
    .rating-modal-body,
    .rating-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .star-rating {
        gap: 2px;
    }
    
    .star-button i {
        font-size: 28px;
    }
    
    .recommendation-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .rating-cta-button {
        top: 140px; /* Adjust for mobile - below S button */
        left: 12px; /* LEFT side for mobile too */
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .rating-modal-header h2 {
        font-size: 18px;
    }
    
    .rating-section h3 {
        font-size: 16px;
    }
    
    .star-button i {
        font-size: 24px;
    }
    
    .rating-modal-footer {
        flex-direction: column;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
@media (prefers-contrast: high) {
    .rating-cta-button {
        border: 2px solid white;
    }
    
    .rating-modal-content {
        border: 2px solid #000;
    }
    
    .star-button.active i {
        color: #000;
    }
}

/* ===== STACKED CTA BUTTONS (S and R) ===== */
/* If you need more precise positioning relative to existing S button */
.rating-cta-button.stacked {
    bottom: 80px; /* Default position above S button */
}

/* Adjust based on your existing S button positioning */
.rating-cta-button.with-summary {
    bottom: 80px; /* If S button is at bottom: 20px, R goes at 80px */
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .rating-cta-button {
        animation: none;
    }
    
    .rating-cta-button::before {
        animation: none;
    }
    
    .rating-modal,
    .rating-modal-content,
    .star-button,
    .recommend-button {
        transition: none;
    }
}

/* ===== BODY SCROLL LOCK ===== */
body.modal-open {
    overflow: hidden;
}