/* Admin styles for WebAsk Integration */

.webask-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.webask-error {
    background: #fff5f5;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 15px;
    border-radius: 4px;
    text-align: center;
}

#webask-surveys-container .survey-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

#webask-surveys-container .survey-item h4 {
    margin: 0 0 10px 0;
    color: #23282d;
    font-size: 16px;
}

#webask-surveys-container .survey-item .survey-meta {
    color: #666;
    font-size: 13px;
    margin-bottom: 15px;
    line-height: 1.4;
}

#webask-surveys-container .survey-item .survey-shortcode {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    padding: 12px;
    border-radius: 3px;
    font-family: 'Courier New', Monaco, monospace;
    font-size: 13px;
    color: #333;
    word-break: break-all;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

#webask-surveys-container .survey-item .survey-shortcode:hover {
    background: #e9ecef;
}

#webask-surveys-container .survey-item .survey-shortcode:active {
    background: #dee2e6;
}

/* Admin form improvements */
.webask-admin-container {
    max-width: 1200px;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

/* Improved color scheme */
:root {
    --webask-primary: #2563eb;
    --webask-primary-dark: #1d4ed8;
    --webask-secondary: #64748b;
    --webask-success: #059669;
    --webask-warning: #d97706;
    --webask-error: #dc2626;
    --webask-bg: #ffffff;
    --webask-bg-secondary: #f8fafc;
    --webask-bg-tertiary: #f1f5f9;
    --webask-border: #e2e8f0;
    --webask-border-light: #f1f5f9;
    --webask-text: #1e293b;
    --webask-text-secondary: #64748b;
    --webask-text-muted: #94a3b8;
    --webask-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --webask-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Dark theme variables */
[data-theme="dark"] {
    --webask-primary: #3b82f6;
    --webask-primary-dark: #2563eb;
    --webask-secondary: #94a3b8;
    --webask-success: #10b981;
    --webask-warning: #f59e0b;
    --webask-error: #ef4444;
    --webask-bg: #1e293b;
    --webask-bg-secondary: #334155;
    --webask-bg-tertiary: #475569;
    --webask-border: #475569;
    --webask-border-light: #334155;
    --webask-text: #f1f5f9;
    --webask-text-secondary: #cbd5e1;
    --webask-text-muted: #94a3b8;
    --webask-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --webask-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Full width surveys section */
.webask-full-width {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

/* Setup prompt for when API key is not set */
.webask-setup-prompt {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    animation: slideInDown 0.8s ease-out;
    text-align: center;
}

.webask-setup-prompt .setup-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
}

.webask-setup-prompt .setup-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
}

.webask-settings-section .form-table th {
    width: 200px;
}

.webask-settings-section .form-table td input[type="password"],
.webask-settings-section .form-table td input[type="url"],
.webask-settings-section .form-table td input[type="text"] {
    width: 400px;
}

/* Usage instructions styling */
.webask-usage-instructions {
    line-height: 1.6;
}

.webask-usage-instructions h3 {
    color: #23282d;
    margin-top: 20px;
    margin-bottom: 10px;
}

.webask-usage-instructions h4 {
    color: #32373c;
    margin-top: 15px;
    margin-bottom: 8px;
}

.webask-usage-instructions code {
    background: #f1f1f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Monaco, monospace;
    font-size: 13px;
}

.webask-usage-instructions ul {
    margin-left: 20px;
}

.webask-usage-instructions ul li {
    margin-bottom: 5px;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-text.long {
    width: 100%;
}

.skeleton-button {
    height: 32px;
    width: 120px;
    border-radius: 4px;
}

.skeleton-card {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Enhanced Loading States */
.loading-overlay {
    position: relative;
    pointer-events: none;
}

.loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #005a87);
    border-radius: 2px;
    transition: width 0.3s ease;
    animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 999999;
    max-width: 400px;
}

.toast {
    background: #fff;
    border-left: 4px solid #0073aa;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 10px;
    transform: translateX(100%);
    animation: slideInRight 0.3s ease-out forwards;
    position: relative;
}

.toast.success {
    border-left-color: #46b450;
}

.toast.error {
    border-left-color: #dc3232;
}

.toast.warning {
    border-left-color: #ffb900;
}

.toast.info {
    border-left-color: #00a0d2;
}

.toast-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: #333;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Search and Filter */
.search-filter-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.filter-btn {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.filter-btn:hover {
    background: #f8f9fa;
    border-color: #0073aa;
}

.filter-btn.active {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

/* Preview Modal */
.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.preview-content {
    background: white;
    border-radius: 8px;
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.preview-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-iframe {
    width: 100%;
    height: 70vh;
    border: none;
}

.preview-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-close:hover {
    color: #333;
}

/* Bulk Actions */
.bulk-actions {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    display: none;
}

.bulk-actions.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.bulk-actions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.bulk-actions-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.bulk-checkbox {
    margin-right: 10px;
}

/* Enhanced Statistics */
.stats-chart {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-top: 15px;
}

.chart-container {
    height: 200px;
    position: relative;
    margin: 20px 0;
}

.chart-bar {
    display: flex;
    align-items: end;
    height: 100%;
    gap: 4px;
}

.chart-bar-item {
    flex: 1;
    background: linear-gradient(to top, #0073aa, #005a87);
    border-radius: 2px 2px 0 0;
    min-height: 4px;
    transition: all 0.3s ease;
    position: relative;
}

.chart-bar-item:hover {
    background: linear-gradient(to top, #005a87, #003d5c);
    transform: scaleY(1.05);
}

.chart-label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: #666;
    white-space: nowrap;
}

/* Personalization Settings */
.personalization-settings {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
}

.setting-group {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.setting-group label {
    font-weight: 500;
    color: #495057;
    min-width: 200px;
}

.setting-group select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 14px;
}

.setting-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

/* Compact View */
.compact-view .survey-item {
    padding: 12px;
    margin-bottom: 10px;
}

.compact-view .survey-header h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.compact-view .survey-meta {
    font-size: 12px;
    margin-bottom: 8px;
}

.compact-view .survey-action-buttons {
    margin-top: 8px;
    padding-top: 8px;
}

.compact-view .survey-action-btn {
    padding: 4px 8px;
    font-size: 11px;
}

/* Tooltips */
.tooltip {
    position: relative;
    cursor: help;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    margin-bottom: 5px;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tooltip:hover::after,
.tooltip:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Auto-refresh indicator */
.auto-refresh-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #0073aa;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    animation: pulse 2s infinite;
}

/* Theme switching */
.theme-dark {
    background: #1a1a1a;
    color: #e0e0e0;
}

.theme-dark .webask-settings-section,
.theme-dark .webask-surveys-section,
.theme-dark .webask-debug-section,
.theme-dark .webask-usage-section {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

.theme-dark .survey-item {
    background: #333;
    border-color: #555;
    color: #e0e0e0;
}

.theme-dark .search-filter-container,
.theme-dark .bulk-actions,
.theme-dark .personalization-settings {
    background: #2a2a2a;
    border-color: #444;
}

.theme-dark .search-input,
.theme-dark .filter-btn,
.theme-dark .setting-group select {
    background: #333;
    border-color: #555;
    color: #e0e0e0;
}

.theme-dark .filter-btn:hover {
    background: #444;
}

.theme-dark .filter-btn.active {
    background: #0073aa;
    color: white;
}

/* Progress indicators */
.progress-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #f0f0f0;
    z-index: 999999;
}

.progress-indicator .progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0073aa, #005a87);
    width: 0%;
    transition: width 0.3s ease;
}

/* Enhanced animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Compact view styles */
.compact-view .survey-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
}

.compact-view .survey-item .survey-title {
    font-size: 14px;
    margin-bottom: 4px;
}

.compact-view .survey-item .survey-meta {
    font-size: 12px;
    margin-bottom: 8px;
}

.compact-view .survey-item .survey-actions {
    gap: 6px;
}

.compact-view .survey-item .survey-actions button {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
}

.compact-view .survey-item .survey-stats {
    display: none !important;
}

.compact-view .survey-item .survey-description {
    display: none;
}

.compact-view .search-filter-container {
    margin-bottom: 12px;
}

.compact-view .search-filter-container .search-input {
    padding: 8px 12px;
    font-size: 13px;
}

.compact-view .filter-buttons {
    gap: 6px;
}

.compact-view .filter-buttons .filter-btn {
    padding: 6px 10px;
    font-size: 11px;
}

.compact-view .bulk-actions {
    padding: 8px 12px;
    margin-bottom: 12px;
}

.compact-view .bulk-actions-header {
    font-size: 12px;
}

.compact-view .bulk-actions-buttons {
    gap: 6px;
}

.compact-view .bulk-actions-buttons button {
    padding: 4px 8px;
    font-size: 11px;
}

/* Hidden variables modal styles */
.hidden-variable-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--webask-bg-secondary);
    border: 1px solid var(--webask-border);
    border-radius: 6px;
    margin-bottom: 8px;
}

.add-variable-form {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.add-variable-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--webask-border);
    border-radius: 6px;
    background: var(--webask-bg);
    color: var(--webask-text);
}

.add-variable-form button {
    padding: 8px 16px;
    background: var(--webask-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.add-variable-form button:hover {
    background: var(--webask-primary-dark);
}

.delete-btn {
    background: var(--webask-error);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
}

.delete-btn:hover {
    background: #b91c1c;
}

/* Action buttons in search container */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* Advanced search modal styles */
.search-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-weight: 600;
    color: var(--webask-text);
    font-size: 14px;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--webask-border);
    border-radius: 6px;
    background: var(--webask-bg);
    color: var(--webask-text);
    font-size: 14px;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--webask-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--webask-border);
}

/* Enhanced survey action buttons */
.survey-action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.survey-action-btn.primary {
    background: var(--webask-primary);
    color: white;
}

.survey-action-btn.primary:hover {
    background: var(--webask-primary-dark);
    transform: translateY(-1px);
}

.survey-action-btn.secondary {
    background: var(--webask-secondary);
    color: white;
}

.survey-action-btn.secondary:hover {
    background: #475569;
    transform: translateY(-1px);
}

.survey-action-btn.success {
    background: var(--webask-success);
    color: white;
}

.survey-action-btn.success:hover {
    background: #047857;
    transform: translateY(-1px);
}

.survey-action-btn.warning {
    background: var(--webask-warning);
    color: white;
}

.survey-action-btn.warning:hover {
    background: #b45309;
    transform: translateY(-1px);
}

.survey-action-btn.info {
    background: #0ea5e9;
    color: white;
}

.survey-action-btn.info:hover {
    background: #0284c7;
    transform: translateY(-1px);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Success animations */
.success-bounce {
    animation: bounce 0.6s ease;
}

/* Loading states */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .webask-admin-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .search-filter-container {
        padding: 15px;
    }
    
    .filter-buttons {
        flex-direction: column;
    }
    
    .filter-btn {
        width: 100%;
        text-align: center;
    }
    
    .bulk-actions-buttons {
        flex-direction: column;
    }
    
    .survey-action-buttons {
        flex-direction: column;
    }
    
    .survey-action-btn {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .preview-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .preview-iframe {
        height: 60vh;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    }
    
    .toast {
        background: #2a2a2a;
        color: #fff;
    }
    
    .search-filter-container {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .search-input {
        background: #333;
        border-color: #555;
        color: #fff;
    }
    
    .filter-btn {
        background: #333;
        border-color: #555;
        color: #fff;
    }
    
    .filter-btn:hover {
        background: #444;
    }
    
    .bulk-actions {
        background: #2a2a2a;
        border-color: #444;
    }
}