/**
 * KTPA Feedback Widget Styles
 * Floating button, modal, and contextual prompt
 */

/* ===================
   Floating Button
   =================== */

.ktpa-feedback-float-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    color: #fff;
}

.ktpa-feedback-float-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.ktpa-feedback-float-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .ktpa-feedback-float-btn {
        width: 48px;
        height: 48px;
        bottom: 20px;
        right: 20px;
    }
}

/* Pulse animation to highlight button */
.ktpa-feedback-float-btn.ktpa-pulse-highlight {
    animation: ktpa-pulse 1s ease-in-out 3;
}

@keyframes ktpa-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 6px 24px rgba(102, 126, 234, 0.8);
    }
}

/* ===================
   Footer Feedback Link
   =================== */

.ktpa-footer-feedback {
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    border-top: 1px solid #e2e8f0;
}

.ktpa-footer-feedback a {
    color: #667eea;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ktpa-footer-feedback a:hover {
    color: #764ba2;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .ktpa-footer-feedback {
        padding: 16px;
        margin-top: 30px;
    }

    .ktpa-footer-feedback a {
        font-size: 13px;
    }
}

/* ===================
   Modal Overlay
   =================== */

.ktpa-feedback-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.ktpa-feedback-overlay.active {
    opacity: 1;
    visibility: visible;
}

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

.ktpa-feedback-modal {
    position: fixed;
    bottom: 100px;
    right: 24px;
    transform: translateY(20px) scale(0.9);
    max-width: 500px;
    width: 90%;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ktpa-feedback-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ktpa-feedback-modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 32px;
}

@media (max-width: 768px) {
    .ktpa-feedback-modal {
        width: 95%;
        max-height: calc(100vh - 100px);
        bottom: 80px;
        right: 12px;
        left: 12px;
    }

    .ktpa-feedback-modal-content {
        padding: 24px;
    }
}

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

.ktpa-feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.ktpa-feedback-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
}

.ktpa-feedback-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #718096;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ktpa-feedback-close:hover {
    color: #2d3748;
}

/* ===================
   Form Fields
   =================== */

.ktpa-feedback-field {
    margin-bottom: 24px;
}

.ktpa-feedback-field label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 14px;
}

.ktpa-optional {
    font-weight: 400;
    color: #a0aec0;
    font-size: 13px;
}

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

.ktpa-star-rating {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.ktpa-star {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #e2e8f0;
    transition: all 0.2s;
}

.ktpa-star svg {
    stroke: #cbd5e0;
    fill: transparent;
    transition: all 0.2s;
}

.ktpa-star:hover svg,
.ktpa-star.active svg {
    stroke: #fbbf24;
    fill: #fbbf24;
}

.ktpa-star.selected svg {
    stroke: #f59e0b;
    fill: #f59e0b;
}

/* ===================
   Select & Textarea
   =================== */

.ktpa-feedback-field select,
.ktpa-feedback-field textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: #2d3748;
    transition: border-color 0.2s;
}

.ktpa-feedback-field select:focus,
.ktpa-feedback-field textarea:focus {
    outline: none;
    border-color: #667eea;
}

.ktpa-feedback-field select {
    background: #fff;
    cursor: pointer;
}

.ktpa-feedback-field textarea {
    resize: vertical;
    min-height: 100px;
}

.ktpa-char-count {
    text-align: right;
    font-size: 12px;
    color: #a0aec0;
    margin-top: 4px;
}

.ktpa-char-current {
    font-weight: 600;
    color: #4a5568;
}

.ktpa-terms-link {
    text-align: center;
    margin-top: 8px;
    margin-bottom: 0;
}

.ktpa-terms-link a {
    color: #667eea;
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
}

.ktpa-terms-link a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* ===================
   Form Actions
   =================== */

.ktpa-feedback-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
}

.ktpa-feedback-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ktpa-feedback-btn-cancel {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.ktpa-feedback-btn-cancel:hover {
    background: #edf2f7;
}

.ktpa-feedback-btn-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.ktpa-feedback-btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ktpa-feedback-btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ktpa-btn-loader {
    animation: ktpa-spin 1s linear infinite;
}

@keyframes ktpa-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===================
   Success Message
   =================== */

.ktpa-feedback-success {
    text-align: center;
    padding: 40px 20px;
}

.ktpa-feedback-success svg {
    color: #48bb78;
    margin-bottom: 16px;
}

.ktpa-feedback-success h3 {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    margin: 0 0 8px 0;
}

.ktpa-feedback-success p {
    font-size: 14px;
    color: #718096;
    margin: 0;
}

/* ===================
   Contextual Prompt
   =================== */

.ktpa-feedback-prompt {
    position: fixed;
    bottom: 100px;
    right: 24px;
    max-width: 360px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    z-index: 9998;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ktpa-feedback-prompt.active {
    opacity: 1;
    transform: translateY(0);
}

.ktpa-prompt-content {
    padding: 20px;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 12px;
    align-items: start;
}

.ktpa-prompt-content > svg {
    color: #667eea;
    margin-top: 2px;
}

.ktpa-prompt-content strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.ktpa-prompt-content p {
    font-size: 13px;
    color: #718096;
    margin: 0;
}

.ktpa-prompt-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s;
}

.ktpa-prompt-btn:hover {
    transform: translateY(-1px);
}

.ktpa-prompt-close {
    background: none;
    border: none;
    color: #a0aec0;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.ktpa-prompt-close:hover {
    color: #718096;
}

@media (max-width: 768px) {
    .ktpa-feedback-prompt {
        left: 12px;
        right: 12px;
        bottom: 80px;
        max-width: none;
    }

    .ktpa-prompt-content {
        grid-template-columns: auto 1fr auto;
        grid-template-rows: auto auto;
    }

    .ktpa-prompt-btn {
        grid-column: 2 / 3;
        justify-self: start;
    }

    .ktpa-prompt-close {
        grid-column: 3 / 4;
        grid-row: 1 / 2;
    }
}

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

.ktpa-feedback-btn:focus,
.ktpa-feedback-close:focus,
.ktpa-star:focus,
.ktpa-feedback-float-btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .ktpa-feedback-modal,
    .ktpa-feedback-overlay,
    .ktpa-feedback-float-btn,
    .ktpa-feedback-prompt,
    .ktpa-star,
    .ktpa-feedback-btn {
        transition: none;
    }

    .ktpa-btn-loader {
        animation: none;
    }
}
