/**
 * Survey Widget Styles
 */

.saw-survey-widget {
    background: var(--saw-bg-secondary, #ffffff);
    border-radius: 16px;
    padding: 32px;
    margin: 48px auto;
    max-width: 800px;
    border: 1px solid var(--saw-border-color, #e2e8f0);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    position: relative;
    overflow: hidden;
}

/* Accent top border for visual separation */
.saw-survey-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--saw-accent-primary, #1e73be), var(--saw-accent-secondary, #0073aa));
}

.saw-survey-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.saw-survey-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-size: 1.25rem;
    color: var(--saw-text-primary, #333);
}

.saw-survey-title .dashicons {
    color: var(--saw-accent-primary, #1e73be);
}

.saw-survey-countdown {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--saw-warning-bg, #fff3cd);
    color: var(--saw-warning-text, #856404);
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.saw-survey-description {
    color: var(--saw-text-secondary, #666);
    margin-bottom: 20px;
}

/* Form */
.saw-survey-form {
    position: relative;
}

.saw-survey-question {
    margin-bottom: 24px;
    padding: 16px;
    background: var(--saw-bg-primary, #fff);
    border-radius: 8px;
    border: 1px solid var(--saw-border-color, rgba(0, 0, 0, 0.08));
}

.saw-survey-question-text {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--saw-text-primary, #333);
}

.saw-survey-question-text .required {
    color: var(--saw-danger, #dc3232);
    margin-left: 4px;
}

/* Options */
.saw-survey-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.saw-survey-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--saw-bg-tertiary, #f5f5f5);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.saw-survey-option:hover {
    background: var(--saw-bg-hover, #eee);
}

.saw-survey-option.selected {
    background: var(--saw-accent-bg, rgba(30, 115, 190, 0.1));
    border-color: var(--saw-accent-primary, #1e73be);
}

.saw-survey-option input[type="radio"],
.saw-survey-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--saw-accent-primary, #1e73be);
}

.saw-survey-option-text {
    flex: 1;
    color: var(--saw-text-primary, #333);
}

/* Text input */
.saw-survey-textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid var(--saw-border-color, #ddd);
    border-radius: 8px;
    resize: vertical;
    font-family: inherit;
}

.saw-survey-textarea:focus {
    outline: none;
    border-color: var(--saw-accent-primary, #1e73be);
    box-shadow: 0 0 0 3px var(--saw-accent-bg, rgba(30, 115, 190, 0.1));
}

/* Actions */
.saw-survey-actions {
    margin-top: 20px;
    text-align: center;
}

.saw-survey-submit {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--saw-accent-primary, #1e73be) 0%, var(--saw-accent-secondary, #0073aa) 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.saw-survey-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 115, 190, 0.3);
}

.saw-survey-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Messages */
.saw-survey-voted,
.saw-survey-timer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--saw-survey-timer-text, #856404);
    background: var(--saw-survey-timer-bg, #fff3cd);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    border: 1px solid var(--saw-survey-timer-border, #ffeeba);
}

@media (prefers-color-scheme: dark) {
    :root {
        :root {
            --saw-survey-timer-text: #e2e8f0;
            --saw-survey-timer-bg: rgba(255, 255, 255, 0.1);
            --saw-survey-timer-border: rgba(255, 255, 255, 0.2);
        }
    }
}

body.dark-mode .saw-survey-countdown,
[data-theme="dark"] .saw-survey-countdown {
    color: #fca5a5 !important;
    /* Light Red Text */
    background: rgba(127, 29, 29, 0.4) !important;
    /* Dark Red Transparent BG */
    border: 1px solid rgba(153, 27, 27, 0.5) !important;
    /* Red-800 */
}

body.dark-mode .saw-survey-voted,
[data-theme="dark"] .saw-survey-voted {
    color: #86efac !important;
    /* Light Green Text */
    background: rgba(20, 83, 45, 0.4) !important;
    /* Dark Green Transparent BG */
    border-color: rgba(22, 101, 52, 0.5) !important;
}

.saw-survey-voted {
    color: var(--saw-success, #46b450);
}

.saw-survey-voted .dashicons {
    display: none;
    /* Hide icon to ensure perfect text centering */
}

.saw-survey-closed {
    color: var(--saw-text-muted, #999);
}

.saw-survey-message {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    text-align: center;
}

.saw-survey-message.success {
    background: var(--saw-success-bg, #d4edda);
    color: var(--saw-success, #155724);
}

.saw-survey-message.error {
    background: var(--saw-danger-bg, #f8d7da);
    color: var(--saw-danger, #721c24);
}

/* Results */
.saw-survey-results {
    margin-top: 20px;
}

.saw-survey-result-item {
    margin-bottom: 16px;
}

.saw-survey-result-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.saw-survey-result-text {
    font-weight: 500;
    color: var(--saw-text-primary, #333);
}

.saw-survey-result-stats {
    color: var(--saw-text-secondary, #666);
}

.saw-survey-result-bar-wrapper {
    height: 24px;
    background: var(--saw-bg-tertiary, #e9ecef);
    border-radius: 12px;
    overflow: hidden;
}

.saw-survey-result-bar {
    height: 100%;
    background: linear-gradient(135deg, var(--saw-accent-primary, #1e73be) 0%, var(--saw-accent-secondary, #0073aa) 100%);
    border-radius: 12px;
    transition: width 0.5s ease-out;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    min-width: fit-content;
}

.saw-survey-result-percentage {
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
}

.saw-survey-total {
    text-align: center;
    margin-top: 16px;
    color: var(--saw-text-secondary, #666);
    font-size: 0.875rem;
}

/* Loading */
.saw-survey-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 30px;
    color: var(--saw-text-muted, #999);
}

.saw-survey-loading .spinner {
    float: none;
    margin: 0;
}

/* Info */
.saw-survey-info {
    text-align: center;
    color: var(--saw-text-secondary, #666);
    font-style: italic;
    margin-top: 16px;
}

/* Dark mode support */
[data-theme="dark"] .saw-survey-widget,
.dark-mode .saw-survey-widget {
    --saw-bg-secondary: #1a1a1a;
    --saw-bg-primary: #222;
    --saw-bg-tertiary: #333;
    --saw-bg-hover: #3a3a3a;
    --saw-text-primary: #eee;
    --saw-text-secondary: #aaa;
    --saw-border-color: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 600px) {
    .saw-survey-widget {
        padding: 16px;
    }

    .saw-survey-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .saw-survey-countdown {
        align-self: flex-end;
    }
}