/**
 * Client Reviews - Frontend Form Styles
 *
 * Elegant popup modal for review submission
 *
 * @package Client_Reviews
 */

/* ==========================================================================
   Modal Overlay & Container
   ========================================================================== */

.vvr-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 20px 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    overflow-y: auto;
}

.vvr-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.vvr-modal {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.vvr-modal-overlay.active .vvr-modal {
    transform: scale(1) translateY(0);
}

/* ==========================================================================
   Modal Header
   ========================================================================== */

.vvr-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 28px;
    background: linear-gradient(135deg, #0d6429 0%, #1a8f3d 100%);
    color: #ffffff;
}

.vvr-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.vvr-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.vvr-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: rotate(90deg);
}

.vvr-modal-close svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Modal Body
   ========================================================================== */

.vvr-modal-body {
    padding: 24px 28px;
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* Allows proper flex shrinking */
}

.vvr-modal-description {
    color: #666666;
    font-size: 0.95rem;
    margin: 0 0 20px;
    line-height: 1.5;
}

/* ==========================================================================
   Form Groups
   ========================================================================== */

.vvr-form-group {
    margin-bottom: 16px;
}

/* Two-Column Layout */
.vvr-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.vvr-form-row .vvr-form-group {
    margin-bottom: 16px;
}

.vvr-label {
    display: block;
    font-weight: 600;
    color: #333333;
    margin-bottom: 8px;
    font-size: 0.95rem;
}

.vvr-label .required {
    color: #dc3545;
}

.vvr-input,
.vvr-select,
.vvr-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #ffffff;
    color: #333333;
    font-family: inherit;
}

.vvr-input:focus,
.vvr-select:focus,
.vvr-textarea:focus {
    outline: none;
    border-color: #0d6429;
    box-shadow: 0 0 0 3px rgba(13, 100, 41, 0.15);
}

.vvr-input::placeholder,
.vvr-textarea::placeholder {
    color: #999999;
}

.vvr-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 20px;
    padding-right: 44px;
}

.vvr-textarea {
    resize: vertical;
    min-height: 100px;
}

.vvr-field-note {
    font-size: 0.85rem;
    color: #888888;
    margin: 6px 0 0;
}

/* Character Counter */
.vvr-char-count {
    text-align: right;
    font-size: 0.8rem;
    color: #888888;
    margin-top: 4px;
}

/* ==========================================================================
   Star Rating Input
   ========================================================================== */

.vvr-stars-input {
    display: flex;
    gap: 8px;
}

.vvr-star-btn {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #ddd;
    transition: color 0.15s ease, transform 0.15s ease;
}

.vvr-star-btn:hover,
.vvr-star-btn.hovered {
    color: #ffc107;
    transform: scale(1.1);
}

.vvr-star-btn.active {
    color: #ffc107;
}

.vvr-star-btn svg {
    display: block;
}

/* ==========================================================================
   Checkbox
   ========================================================================== */

.vvr-checkbox-group {
    margin-top: 8px;
    margin-bottom: 0;
}

.vvr-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.vvr-checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #0d6429;
}

.vvr-checkbox-text {
    font-size: 0.9rem;
    color: #555555;
    line-height: 1.5;
}

.vvr-checkbox-text a {
    color: #0d6429;
    text-decoration: underline;
}

.vvr-checkbox-text a:hover {
    color: #1a8f3d;
}

/* ==========================================================================
   Error Messages
   ========================================================================== */

.vvr-error {
    display: block;
    color: #dc3545;
    font-size: 0.85rem;
    margin-top: 6px;
    min-height: 0;
}

.vvr-form-group.has-error .vvr-input,
.vvr-form-group.has-error .vvr-select,
.vvr-form-group.has-error .vvr-textarea {
    border-color: #dc3545;
}

/* ==========================================================================
   Modal Footer (Sticky)
   ========================================================================== */

.vvr-modal-footer {
    padding: 20px 28px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */

.vvr-form-actions {
    margin: 0;
}

.vvr-submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #0d6429 0%, #1a8f3d 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vvr-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 100, 41, 0.3);
}

.vvr-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.vvr-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Loading State */
.vvr-btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vvr-spinner {
    animation: vvr-spin 1s linear infinite;
}

.vvr-spinner-track {
    stroke: rgba(255, 255, 255, 0.3);
}

.vvr-spinner-head {
    stroke: #ffffff;
    stroke-linecap: round;
    transform-origin: center;
    animation: vvr-spinner-dash 1.5s ease-in-out infinite;
}

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

@keyframes vvr-spinner-dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

/* ==========================================================================
   Messages
   ========================================================================== */

.vvr-message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.vvr-message svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.vvr-success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.vvr-success-message svg {
    color: #28a745;
}

.vvr-error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.vvr-error-message svg {
    color: #dc3545;
}

/* ==========================================================================
   Review Button (Default Styling)
   ========================================================================== */

.vvr-open-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    background: linear-gradient(135deg, #0d6429 0%, #1a8f3d 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
}

.vvr-open-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(13, 100, 41, 0.3);
    color: #ffffff;
}

.vvr-open-modal:active {
    transform: translateY(0);
}

.vvr-open-modal svg {
    flex-shrink: 0;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 600px) {
    .vvr-modal-overlay {
        padding: 30px 12px 12px;
    }

    .vvr-modal {
        max-height: 95vh;
        border-radius: 12px;
    }

    .vvr-modal-header {
        padding: 16px 20px;
    }

    .vvr-modal-header h2 {
        font-size: 1.25rem;
    }

    .vvr-modal-body {
        padding: 20px;
    }

    .vvr-modal-footer {
        padding: 16px 20px;
    }

    /* Single column on mobile */
    .vvr-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .vvr-star-btn svg {
        width: 28px;
        height: 28px;
    }

    .vvr-submit-btn {
        padding: 12px 20px;
    }
}

/* ==========================================================================
   Animation for Success State
   ========================================================================== */

.vvr-form-submitted .vvr-form-group {
    opacity: 0.3;
    pointer-events: none;
}

/* Disable footer when form is submitted (uses :has() for sibling targeting) */
.vvr-modal-body:has(.vvr-form-submitted) + .vvr-modal-footer .vvr-form-actions {
    opacity: 0.3;
    pointer-events: none;
}

.vvr-success-message.show {
    animation: vvr-fadeIn 0.3s ease;
}

@keyframes vvr-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.vvr-modal:focus {
    outline: none;
}

.vvr-star-btn:focus {
    outline: 2px solid #0d6429;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .vvr-modal-overlay,
    .vvr-modal,
    .vvr-modal-close,
    .vvr-star-btn,
    .vvr-submit-btn,
    .vvr-open-modal {
        transition: none;
    }

    .vvr-spinner,
    .vvr-spinner-head {
        animation: none;
    }
}
