/**
 * Frontend Styles - Google Review Link Generator
 * Farben angepasst an QR-Code-Generator
 */

/* CSS Variables */
.grl-generator {
    --grl-primary: #2D61F0;
    --grl-primary-dark: #1e4bc7;
    --grl-secondary: #64748b;
    --grl-background: #ffffff;
    --grl-surface: #ECF0F9;
    --grl-border: #d4dae8;
    --grl-text: #020B60;
    --grl-text-light: #5a6299;
    --grl-success: #A6D30F;
    --grl-success-dark: #8fb60c;
    --grl-error: #ef4444;
    --grl-warning: #f59e0b;
    --grl-hover: rgba(45, 97, 240, 0.1);
    --grl-radius: 12px;
    --grl-shadow: 0 1px 3px 0 rgb(2 11 96 / 0.08), 0 1px 2px -1px rgb(2 11 96 / 0.06);
    --grl-shadow-lg: 0 10px 15px -3px rgb(2 11 96 / 0.1), 0 4px 6px -4px rgb(2 11 96 / 0.08);
}

/* Reset & Base */
.grl-generator * {
    box-sizing: border-box;
}

.grl-generator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--grl-text);
    line-height: 1.5;
    max-width: 800px;
    margin: 2rem auto;
    width: 100%;
}

/* Header */
.grl-header {
    background: linear-gradient(135deg, var(--grl-primary) 0%, var(--grl-primary-dark) 100%);
    color: white;
    padding: 2.5rem 2rem;
    text-align: center;
    border-radius: var(--grl-radius) var(--grl-radius) 0 0;
}

.grl-header-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
}

.grl-header-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

.grl-body {
    background: var(--grl-background);
    border: 1px solid var(--grl-border);
    border-top: none;
    border-radius: 0 0 var(--grl-radius) var(--grl-radius);
    padding: 2rem;
    box-shadow: var(--grl-shadow);
}

/* Alerts */
.grl-alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.grl-alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.grl-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #86efac;
}

.grl-alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.grl-alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.grl-icon {
    flex-shrink: 0;
    font-size: 1.2rem;
}

/* Search Container */
.grl-search-container {
    position: relative;
    margin-bottom: 2rem;
}

.grl-search-input {
    width: 100% !important;
    padding: 1rem 1.25rem 1rem 3.75rem !important;
    font-size: 1rem !important;
    border: 2px solid var(--grl-border) !important;
    border-radius: 12px !important;
    outline: none !important;
    transition: all 0.2s !important;
    background: var(--grl-surface) !important;
    color: var(--grl-text) !important;
    box-sizing: border-box !important;
}

.grl-search-input::placeholder {
    color: var(--grl-text-light) !important;
    opacity: 0.7 !important;
}

.grl-search-input:focus {
    border-color: var(--grl-primary) !important;
    box-shadow: 0 0 0 4px rgb(45 97 240 / 0.1) !important;
    background: var(--grl-background) !important;
}

.grl-search-input:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    background: #f3f4f6 !important;
    border-color: #e5e7eb !important;
}

.grl-search-icon {
    position: absolute !important;
    left: 1.25rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: var(--grl-primary) !important;
    pointer-events: none !important;
    width: 20px !important;
    height: 20px !important;
}

/* Search Suggestions */
.grl-search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--grl-background);
    border: 1px solid var(--grl-border);
    border-radius: 8px;
    box-shadow: var(--grl-shadow-lg);
    display: none;
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
}

.grl-search-suggestions.active {
    display: block;
}

.grl-suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    border-bottom: 1px solid var(--grl-surface);
}

.grl-suggestion-item:last-child {
    border-bottom: none;
}

.grl-suggestion-item:hover,
.grl-suggestion-item.selected {
    background-color: var(--grl-hover);
}

.grl-suggestion-name {
    font-weight: 500;
    color: var(--grl-text);
    margin-bottom: 0.25rem;
}

.grl-suggestion-address {
    font-size: 0.875rem;
    color: var(--grl-text-light);
}

.grl-suggestion-hint {
    color: var(--grl-text-light);
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* Selected Business */
.grl-selected-business {
    background: var(--grl-surface);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: none;
}

.grl-selected-business.active {
    display: block;
    animation: slideIn 0.3s ease;
}

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

.grl-selected-label {
    font-size: 0.875rem;
    color: var(--grl-text-light);
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.grl-selected-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--grl-text);
    margin-bottom: 0.25rem;
}

.grl-selected-address {
    color: var(--grl-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Buttons */
.grl-generate-btn {
    width: 100%;
    padding: 1rem;
    background: var(--grl-success);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.grl-generate-btn:hover:not(:disabled) {
    background: var(--grl-success-dark);
    transform: translateY(-1px);
    box-shadow: 0 10px 25px -5px rgb(166 211 15 / 0.25);
}

.grl-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.grl-generate-btn:active {
    transform: translateY(0);
}

/* Result Container */
.grl-result-container {
    display: none;
}

.grl-result-container.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.grl-result-box {
    background: var(--grl-surface);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.grl-result-label {
    font-weight: 600;
    color: var(--grl-text);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grl-result-link {
    background: var(--grl-background);
    padding: 1rem;
    border-radius: 6px;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--grl-text-light);
    border: 1px solid var(--grl-border);
    margin-bottom: 1rem;
}

.grl-action-buttons {
    display: flex;
    gap: 0.75rem;
}

.grl-action-btn {
    flex: 1;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 50px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.grl-copy-btn {
    background: var(--grl-primary);
    color: white;
}

.grl-copy-btn:hover {
    background: var(--grl-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 97, 240, 0.3);
}

.grl-copy-btn.copied {
    background: var(--grl-success);
}

.grl-qr-btn {
    background: var(--grl-secondary);
    color: white;
}

.grl-qr-btn:hover {
    background: #475569;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

/* QR Modal */
.grl-qr-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.grl-qr-content {
    background: var(--grl-background);
    padding: 2rem;
    border-radius: var(--grl-radius);
    text-align: center;
    position: relative;
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.grl-qr-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: var(--grl-surface);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1.5rem;
    color: var(--grl-text);
}

.grl-qr-close:hover {
    background: var(--grl-error);
    color: white;
    transform: rotate(90deg);
}

.grl-qr-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--grl-text);
}

#grl-qrcode {
    margin: 1.5rem auto;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    display: inline-block;
}

.grl-qr-info {
    color: var(--grl-text-light);
    font-size: 0.95rem;
    margin-top: 1rem;
}

/* Privacy Tooltip */
.grl-privacy-tooltip-container {
    position: relative;
    display: inline-block;
    margin-top: 2rem;
}

.grl-privacy-tooltip-trigger {
    background: transparent;
    border: 1px solid var(--grl-border);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--grl-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.grl-privacy-tooltip-trigger:hover {
    background: var(--grl-surface);
    border-color: var(--grl-primary);
    color: var(--grl-primary);
}

.grl-privacy-tooltip-trigger svg {
    flex-shrink: 0;
}

.grl-privacy-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--grl-text);
    color: white;
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 320px;
    font-size: 0.875rem;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
}

.grl-privacy-tooltip[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.grl-privacy-tooltip-arrow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--grl-text);
}

.grl-privacy-tooltip-content p {
    margin: 0 0 0.75rem 0;
}

.grl-privacy-tooltip-content p:last-child {
    margin-bottom: 0;
}

.grl-privacy-tooltip-content ul {
    margin: 0 0 0.75rem 1.25rem;
    padding: 0;
    list-style: disc;
}

.grl-privacy-tooltip-content li {
    margin-bottom: 0.25rem;
    opacity: 0.9;
}

.grl-privacy-tooltip-content a {
    color: var(--grl-primary);
    text-decoration: none;
    font-weight: 500;
}

.grl-privacy-tooltip-content a:hover {
    text-decoration: underline;
}

/* Mobile adjustments for tooltip */
@media (max-width: 480px) {
    .grl-privacy-tooltip {
        width: 280px;
        left: 0;
        transform: translateX(0);
    }
    
    .grl-privacy-tooltip-arrow {
        left: 2rem;
    }
}

/* Loading State */
.grl-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive - Enhanced Mobile Support */
@media (max-width: 768px) {
    .grl-generator {
        margin: 0.5rem;
    }
    
    .grl-header {
        padding: 1.5rem 1rem;
        border-radius: 8px 8px 0 0;
    }
    
    .grl-header-title {
        font-size: 1.5rem;
        line-height: 1.2;
    }
    
    .grl-header-subtitle {
        font-size: 0.95rem;
    }
    
    .grl-body {
        padding: 1rem;
        border-radius: 0 0 8px 8px;
    }
    
    /* Improve touch targets */
    .grl-search-input {
        padding: 1rem 1.25rem 1rem 3.75rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .grl-suggestion-item {
        padding: 16px;
        min-height: 60px;
    }
    
    .grl-generate-btn {
        padding: 1.25rem;
        font-size: 1.1rem;
    }
    
    .grl-action-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .grl-action-btn {
        padding: 1rem;
        font-size: 1rem;
    }
    
    .grl-qr-content {
        padding: 1.5rem 1rem;
        margin: 0.5rem;
        width: calc(100% - 1rem);
        max-width: 90vw;
    }
    
    .grl-qr-close {
        width: 44px;
        height: 44px;
    }
    
    /* Improve readability */
    .grl-result-link {
        font-size: 0.8rem;
        padding: 1rem 0.75rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Better alert spacing */
    .grl-alert {
        padding: 0.875rem 1rem;
        margin-bottom: 1rem;
    }
    
    /* Adjust modal for mobile */
    .grl-qr-modal {
        padding: 1rem;
    }
    
    /* Privacy tooltip adjustments */
    .grl-privacy-tooltip-container {
        display: block;
        text-align: center;
        margin-top: 1.5rem;
    }
    
    .grl-selected-business {
        padding: 1rem;
    }
    
    .grl-selected-name {
        font-size: 1.1rem;
    }
    
    /* Improve search suggestions on mobile */
    .grl-search-suggestions {
        max-height: 50vh;
        margin-top: 4px;
    }
}

@media (max-width: 480px) {
    .grl-generator {
        margin: 0;
        border-radius: 0;
    }
    
    .grl-header {
        border-radius: 0;
        padding: 1.25rem 1rem;
    }
    
    .grl-header-title {
        font-size: 1.25rem;
    }
    
    .grl-header-subtitle {
        font-size: 0.875rem;
    }
    
    .grl-body {
        border-radius: 0;
        border-left: none;
        border-right: none;
        padding: 1rem 0.75rem;
    }
    
    /* Full width buttons on small screens */
    .grl-generate-btn,
    .grl-action-btn {
        width: 100%;
        border-radius: 8px;
    }
    
    /* Optimize QR modal for small screens */
    #grl-qrcode {
        transform: scale(0.8);
        margin: 0.5rem auto;
    }
    
    .grl-qr-title {
        font-size: 1.25rem;
    }
    
    /* Better spacing for limit info */
    .grl-limit-info {
        font-size: 0.875rem;
        padding: 0.75rem;
    }
}

/* Touch-friendly hover states */
@media (hover: none) and (pointer: coarse) {
    .grl-suggestion-item:active {
        background-color: var(--grl-hover);
    }
    
    .grl-generate-btn:active:not(:disabled) {
        transform: scale(0.98);
    }
    
    .grl-action-btn:active {
        transform: scale(0.98);
    }
    
    /* Remove hover effects on touch devices */
    .grl-suggestion-item:hover {
        background-color: transparent;
    }
}

/* Hidden Utility */
.grl-hidden {
    display: none !important;
}

/* WordPress Theme Compatibility */
.grl-generator button {
    font-family: inherit;
    line-height: normal;
}

.grl-generator input,
.grl-generator select,
.grl-generator textarea {
    font-family: inherit;
    line-height: normal;
}