/**
 * Frontend-CSS für das Google Places Rating Plugin
 * Unterstützt alle Widget-Zustände, Animationen und Responsive Design
 *
 * @package GooglePlacesRating
 * @since   1.1.0
 */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    --gpr-primary-color: #2271b1;
    --gpr-star-color: #00a32a;
    --gpr-star-empty-color: #ddd;
    --gpr-border-radius: 8px;
    --gpr-star-size: 24px;
    --gpr-spacing: 16px;
    --gpr-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --gpr-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --gpr-transition: all 0.3s ease;
    --gpr-success-color: #00a32a;
    --gpr-error-color: #d63638;
    --gpr-warning-color: #dba617;
}

/* ===== WIDGET CONTAINER ===== */
.gpr-widget {
    font-family: var(--gpr-font-family);
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: var(--gpr-border-radius);
    padding: var(--gpr-spacing);
    margin: var(--gpr-spacing) 0;
    box-shadow: var(--gpr-shadow);
    position: relative;
    overflow: hidden;
    max-width: 400px;
    transition: var(--gpr-transition);
}

.gpr-widget:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Widget-Stile */
.gpr-style-modern {
    border-radius: 12px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
}

.gpr-style-classic {
    border-radius: 4px;
    border: 2px solid #ddd;
    background: #fff;
}

.gpr-style-minimal {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: calc(var(--gpr-spacing) / 2);
}

.gpr-style-card {
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: none;
}

/* ===== WIDGET HEADER ===== */
.gpr-widget-header {
    text-align: center;
    margin-bottom: var(--gpr-spacing);
}

.gpr-widget-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1e1e1e;
    line-height: 1.3;
}

/* ===== STERNE-RATING ===== */
.gpr-rating-container {
    text-align: center;
    margin-bottom: var(--gpr-spacing);
}

.gpr-stars {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.gpr-star {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: var(--gpr-star-size);
    line-height: 1;
    transition: var(--gpr-transition);
    border-radius: 4px;
    position: relative;
    outline: none;
}

.gpr-star:focus {
    outline: 2px solid var(--gpr-primary-color);
    outline-offset: 2px;
}

.gpr-star-icon {
    color: var(--gpr-star-empty-color);
    transition: var(--gpr-transition);
    display: block;
}

.gpr-star:hover .gpr-star-icon,
.gpr-star.gpr-star-hover .gpr-star-icon {
    color: var(--gpr-star-color);
    transform: scale(1.1);
}

.gpr-star.gpr-star-selected .gpr-star-icon,
.gpr-star.gpr-star-filled .gpr-star-icon {
    color: var(--gpr-star-color);
}

.gpr-star.gpr-star-empty .gpr-star-icon {
    color: var(--gpr-star-empty-color);
}

/* Sterne-Display (nur Anzeige) */
.gpr-stars-display .gpr-star {
    cursor: default;
    pointer-events: none;
}

/* ===== ANIMATIONEN ===== */
.gpr-animations-enabled .gpr-star {
    transition: transform 0.2s ease, color 0.2s ease;
}

.gpr-animations-enabled .gpr-star:hover {
    transform: scale(1.1);
}

.gpr-animations-enabled .gpr-star:active {
    transform: scale(0.95);
}

/* ===== FORMULAR ===== */
.gpr-form-container {
    margin-top: var(--gpr-spacing);
    padding-top: var(--gpr-spacing);
    border-top: 1px solid #e0e0e0;
    transition: var(--gpr-transition);
}

.gpr-form-container.gpr-form-visible {
    display: block !important;
    animation: gpr-slide-down 0.3s ease-out;
}

.gpr-form-container.gpr-form-hidden {
    animation: gpr-slide-up 0.3s ease-out;
}

@keyframes gpr-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
    }
}

@keyframes gpr-slide-up {
    from {
        opacity: 1;
        transform: translateY(0);
        max-height: 500px;
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
}

.gpr-rating-form {
    display: flex;
    flex-direction: column;
    gap: var(--gpr-spacing);
}

.gpr-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gpr-form-label {
    font-weight: 500;
    color: #1e1e1e;
    font-size: 14px;
}

.gpr-required {
    color: var(--gpr-error-color);
    font-weight: bold;
}

.gpr-form-input,
.gpr-form-textarea {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: var(--gpr-border-radius);
    font-size: 14px;
    font-family: inherit;
    transition: var(--gpr-transition);
    background: #fff;
}

.gpr-form-input:focus,
.gpr-form-textarea:focus {
    outline: none;
    border-color: var(--gpr-primary-color);
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

.gpr-form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* DSGVO-Checkbox */
.gpr-gdpr-field {
    margin-top: 8px;
}

.gpr-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
}

.gpr-checkbox {
    margin: 0;
    flex-shrink: 0;
    margin-top: 2px;
}

.gpr-checkbox-text a {
    color: var(--gpr-primary-color);
    text-decoration: none;
}

.gpr-checkbox-text a:hover {
    text-decoration: underline;
}

/* Submit-Button */
.gpr-form-actions {
    margin-top: 8px;
}

.gpr-submit-button {
    background: var(--gpr-primary-color);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--gpr-border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--gpr-transition);
    width: 100%;
}

.gpr-submit-button:hover {
    background: #1e5a8a;
    transform: translateY(-1px);
}

.gpr-submit-button:active {
    transform: translateY(0);
}

.gpr-submit-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ===== KONFETTI-CANVAS ===== */
.gpr-confetti-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

/* ===== COUNTDOWN-CONTAINER ===== */
.gpr-countdown-container {
    text-align: center;
    padding: var(--gpr-spacing);
    background: linear-gradient(135deg, #00a32a, #00ba37);
    color: #fff;
    border-radius: var(--gpr-border-radius);
    margin-top: var(--gpr-spacing);
    animation: gpr-fade-in 0.5s ease-out;
}

.gpr-countdown-container.gpr-countdown-visible {
    display: block !important;
}

.gpr-countdown-message p {
    margin: 0 0 8px 0;
    font-weight: 500;
}

.gpr-countdown-text {
    font-size: 14px;
    opacity: 0.9;
}

.gpr-countdown-timer {
    font-weight: bold;
    font-size: 18px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

@keyframes gpr-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== WIDGET-ZUSTÄNDE ===== */

/* Completed State */
.gpr-state-completed {
    text-align: center;
}

.gpr-completed-message {
    padding: var(--gpr-spacing);
}

.gpr-completed-icon {
    font-size: 48px;
    color: var(--gpr-success-color);
    margin-bottom: 12px;
    animation: gpr-bounce 0.6s ease-out;
}

@keyframes gpr-bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.gpr-completed-message h3 {
    margin: 0 0 8px 0;
    color: var(--gpr-success-color);
    font-size: 18px;
}

.gpr-completed-message p {
    margin: 0 0 16px 0;
    color: #666;
    font-size: 14px;
}

/* Thank You State */
.gpr-state-thank-you {
    text-align: center;
}

.gpr-thank-you-message {
    padding: var(--gpr-spacing);
}

.gpr-thank-you-icon {
    font-size: 48px;
    margin-bottom: 30px;
    animation: gpr-sparkle 1s ease-in-out infinite alternate;
}

@keyframes gpr-sparkle {
    from {
        transform: scale(1);
        filter: brightness(1);
    }
    to {
        transform: scale(1.05);
        filter: brightness(1.2);
    }
}

.gpr-thank-you-message h3 {
    margin: 0 0 8px 0;
    color: var(--gpr-success-color);
    font-size: 18px;
}

.gpr-thank-you-message p {
    margin: 0 0 16px 0;
    color: #666;
    font-size: 14px;
}

/* User Rating Display */
.gpr-user-rating {
    margin: 16px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: var(--gpr-border-radius);
    border: 1px solid #e0e0e0;
}

.gpr-rating-date {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #666;
}

/* Edit Rating Button */
.gpr-edit-rating {
    margin-top: 16px;
}

.gpr-edit-button {
    display: inline-block;
    background: var(--gpr-success-color);
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: var(--gpr-border-radius);
    font-size: 14px;
    font-weight: 500;
    transition: var(--gpr-transition);
}

.gpr-edit-button:hover {
    background: #008a00;
    transform: translateY(-1px);
    text-decoration: none;
    color: #fff;
}

/* ===== STATISTIKEN ===== */
.gpr-statistics {
    text-align: center;
    margin: var(--gpr-spacing) 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: var(--gpr-border-radius);
    border: 1px solid #e0e0e0;
}

.gpr-stats-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.gpr-average-rating {
    font-size: 18px;
    font-weight: bold;
    color: var(--gpr-primary-color);
}

.gpr-total-ratings {
    font-size: 14px;
    color: #666;
}

/* ===== LOADING-STATES ===== */
.gpr-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.gpr-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ddd;
    border-top-color: var(--gpr-primary-color);
    border-radius: 50%;
    animation: gpr-spin 1s linear infinite;
}

@keyframes gpr-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== ERROR-STATES ===== */
.gpr-error {
    background: #fff2f2;
    border-color: var(--gpr-error-color);
    color: var(--gpr-error-color);
}

.gpr-error-message {
    background: var(--gpr-error-color);
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--gpr-border-radius);
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
}

/* ===== SUCCESS-STATES ===== */
.gpr-success {
    background: #f0f8f0;
    border-color: var(--gpr-success-color);
}

.gpr-success-message {
    background: var(--gpr-success-color);
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--gpr-border-radius);
    font-size: 14px;
    margin-top: 8px;
    text-align: center;
}

/* ===== RESPONSIVE DESIGN ===== */
.gpr-mobile-optimized {
    /* Mobile-spezifische Optimierungen */
}

@media (max-width: 480px) {
    .gpr-widget {
        margin: 8px 0;
        padding: 12px;
        max-width: 100%;
    }
    
    .gpr-star {
        font-size: calc(var(--gpr-star-size) * 0.9);
        padding: 2px;
    }
    
    .gpr-widget-title {
        font-size: 16px;
    }
    
    .gpr-form-input,
    .gpr-form-textarea {
        padding: 8px 10px;
        font-size: 16px; /* Verhindert Zoom auf iOS */
    }
    
    .gpr-submit-button {
        padding: 14px 20px;
        font-size: 16px;
    }
    
    .gpr-countdown-container {
        padding: 12px;
    }
    
    .gpr-completed-icon,
    .gpr-thank-you-icon {
        font-size: 36px;
    }
}

@media (max-width: 320px) {
    .gpr-widget {
        padding: 8px;
    }
    
    .gpr-star {
        font-size: calc(var(--gpr-star-size) * 0.8);
        gap: 2px;
    }
    
    .gpr-widget-title {
        font-size: 14px;
    }
}

/* ===== HIGH CONTRAST MODE ===== */
.gpr-high-contrast {
    --gpr-primary-color: #000;
    --gpr-star-color: #000;
    --gpr-star-empty-color: #666;
    --gpr-success-color: #000;
    border: 2px solid #000;
    background: #fff;
}

.gpr-high-contrast .gpr-star:focus {
    outline: 3px solid #000;
    outline-offset: 2px;
}

.gpr-high-contrast .gpr-form-input:focus,
.gpr-high-contrast .gpr-form-textarea:focus {
    border: 2px solid #000;
    box-shadow: none;
}

/* ===== PRINT STYLES ===== */
@media print {
    .gpr-widget {
        box-shadow: none;
        border: 1px solid #000;
        background: #fff;
        break-inside: avoid;
    }
    
    .gpr-confetti-canvas,
    .gpr-countdown-container {
        display: none !important;
    }
    
    .gpr-submit-button,
    .gpr-edit-button {
        display: none;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
.gpr-star:focus-visible {
    outline: 2px solid var(--gpr-primary-color);
    outline-offset: 2px;
}

.gpr-form-input:focus-visible,
.gpr-form-textarea:focus-visible {
    outline: 2px solid var(--gpr-primary-color);
    outline-offset: 1px;
}

.gpr-submit-button:focus-visible,
.gpr-edit-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}


/* Screen Reader Only */
.gpr-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== CUSTOM ANIMATIONS ===== */
@keyframes gpr-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.gpr-pulse {
    animation: gpr-pulse 2s infinite;
}

@keyframes gpr-shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-2px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(2px);
    }
}

.gpr-shake {
    animation: gpr-shake 0.5s ease-in-out;
}

/* ===== UTILITY CLASSES ===== */
.gpr-hidden {
    display: none !important;
}

.gpr-visible {
    display: block !important;
}

.gpr-text-center {
    text-align: center;
}

.gpr-text-left {
    text-align: left;
}

.gpr-text-right {
    text-align: right;
}

.gpr-mb-0 {
    margin-bottom: 0 !important;
}

.gpr-mt-0 {
    margin-top: 0 !important;
}

.gpr-p-0 {
    padding: 0 !important;
}


input.text, input.title, input[type=email], input[type=password], input[type=tel], input[type=text], select, textarea
{
    padding: 9px!important;
    color: #4e4e4e;
}