/**
 * WebComm.Digital WebP Converter - Admin Styles
 * Modern, responsive, and accessible design
 */

/* CSS Variables */
:root {
    --webcomm-primary: #6366F1;
    --webcomm-primary-dark: #4F46E5;
    --webcomm-primary-light: #818CF8;
    --webcomm-secondary: #8B5CF6;
    --webcomm-success: #10B981;
    --webcomm-success-light: #D1FAE5;
    --webcomm-warning: #F59E0B;
    --webcomm-error: #EF4444;
    --webcomm-error-light: #FEE2E2;
    --webcomm-gray-50: #F9FAFB;
    --webcomm-gray-100: #F3F4F6;
    --webcomm-gray-200: #E5E7EB;
    --webcomm-gray-300: #D1D5DB;
    --webcomm-gray-400: #9CA3AF;
    --webcomm-gray-500: #6B7280;
    --webcomm-gray-600: #4B5563;
    --webcomm-gray-700: #374151;
    --webcomm-gray-800: #1F2937;
    --webcomm-gray-900: #111827;
    --webcomm-white: #FFFFFF;
    --webcomm-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --webcomm-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --webcomm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --webcomm-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --webcomm-radius-sm: 6px;
    --webcomm-radius: 12px;
    --webcomm-radius-lg: 16px;
    --webcomm-radius-xl: 24px;
    --webcomm-transition: all 0.2s ease-in-out;
}

/* Reset and Base */
.webcomm-wrap {
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--webcomm-gray-50) 0%, var(--webcomm-gray-100) 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    box-sizing: border-box;
}

.webcomm-wrap *,
.webcomm-wrap *::before,
.webcomm-wrap *::after {
    box-sizing: border-box;
}

.webcomm-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.webcomm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    background: var(--webcomm-white);
    border-radius: var(--webcomm-radius-lg);
    box-shadow: var(--webcomm-shadow);
    margin-bottom: 24px;
}

.webcomm-logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.webcomm-logo svg {
    flex-shrink: 0;
}

.webcomm-brand h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: var(--webcomm-gray-900);
    line-height: 1.2;
}

.webcomm-tagline {
    font-size: 14px;
    color: var(--webcomm-gray-500);
    font-weight: 500;
}

.webcomm-version {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: var(--webcomm-gray-100);
    color: var(--webcomm-gray-600);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Status Bar */
.webcomm-status-bar {
    margin-bottom: 24px;
}

.webcomm-status {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: var(--webcomm-radius);
    font-weight: 500;
    font-size: 14px;
}

.webcomm-status-success {
    background: var(--webcomm-success-light);
    color: #065F46;
}

.webcomm-status-error {
    background: var(--webcomm-error-light);
    color: #991B1B;
}

/* Info Cards */
.webcomm-info-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.webcomm-card {
    background: var(--webcomm-white);
    border-radius: var(--webcomm-radius);
    padding: 24px;
    box-shadow: var(--webcomm-shadow-sm);
    transition: var(--webcomm-transition);
}

.webcomm-card:hover {
    box-shadow: var(--webcomm-shadow);
    transform: translateY(-2px);
}

.webcomm-card-info {
    display: flex;
    gap: 16px;
}

.webcomm-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--webcomm-primary) 0%, var(--webcomm-secondary) 100%);
    border-radius: var(--webcomm-radius-sm);
    color: var(--webcomm-white);
    flex-shrink: 0;
}

.webcomm-card-content h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: var(--webcomm-gray-800);
}

.webcomm-card-content p {
    margin: 0;
    font-size: 14px;
    color: var(--webcomm-gray-500);
    line-height: 1.5;
}

/* Converter Section */
.webcomm-converter {
    background: var(--webcomm-white);
    border-radius: var(--webcomm-radius-lg);
    padding: 32px;
    box-shadow: var(--webcomm-shadow);
}

.webcomm-converter-header {
    text-align: center;
    margin-bottom: 24px;
}

.webcomm-converter-header h2 {
    margin: 0 0 8px;
    font-size: 28px;
    font-weight: 700;
    color: var(--webcomm-gray-900);
}

.webcomm-converter-header p {
    margin: 0;
    color: var(--webcomm-gray-500);
    font-size: 15px;
}

/* Settings Panel */
.webcomm-settings {
    background: var(--webcomm-gray-50);
    border-radius: var(--webcomm-radius);
    padding: 20px 24px;
    margin-bottom: 24px;
}

.webcomm-setting-item label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--webcomm-gray-700);
    margin-bottom: 10px;
}

.webcomm-quality-control {
    display: flex;
    align-items: center;
    gap: 16px;
}

.webcomm-range {
    flex: 1;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--webcomm-gray-200);
    border-radius: 4px;
    outline: none;
}

.webcomm-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--webcomm-primary) 0%, var(--webcomm-secondary) 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--webcomm-shadow);
    transition: var(--webcomm-transition);
}

.webcomm-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.webcomm-range::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--webcomm-primary) 0%, var(--webcomm-secondary) 100%);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--webcomm-shadow);
}

.webcomm-quality-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--webcomm-primary);
    min-width: 50px;
}

.webcomm-setting-desc {
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--webcomm-gray-400);
}

/* Dropzone */
.webcomm-dropzone {
    position: relative;
    border: 3px dashed var(--webcomm-gray-300);
    border-radius: var(--webcomm-radius-lg);
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--webcomm-transition);
    background: var(--webcomm-gray-50);
}

.webcomm-dropzone:hover,
.webcomm-dropzone.dragover {
    border-color: var(--webcomm-primary);
    background: rgba(99, 102, 241, 0.05);
}

.webcomm-dropzone.dragover {
    transform: scale(1.01);
}

.webcomm-dropzone-content {
    pointer-events: none;
}

.webcomm-dropzone-icon {
    color: var(--webcomm-gray-400);
    margin-bottom: 16px;
    transition: var(--webcomm-transition);
}

.webcomm-dropzone:hover .webcomm-dropzone-icon {
    color: var(--webcomm-primary);
    transform: translateY(-4px);
}

.webcomm-dropzone h3 {
    margin: 0 0 8px;
    font-size: 20px;
    font-weight: 600;
    color: var(--webcomm-gray-700);
}

.webcomm-dropzone p {
    margin: 0 0 12px;
    color: var(--webcomm-gray-500);
    font-size: 15px;
}

.webcomm-formats {
    display: inline-block;
    padding: 6px 16px;
    background: var(--webcomm-white);
    border-radius: 20px;
    font-size: 13px;
    color: var(--webcomm-gray-500);
    box-shadow: var(--webcomm-shadow-sm);
}

.webcomm-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Preview Area */
.webcomm-preview-area {
    margin-top: 24px;
    animation: fadeIn 0.3s ease-out;
}

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

.webcomm-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.webcomm-preview-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--webcomm-gray-800);
}

.webcomm-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.webcomm-preview-item {
    position: relative;
    background: var(--webcomm-gray-100);
    border-radius: var(--webcomm-radius);
    overflow: hidden;
    aspect-ratio: 1;
    transition: var(--webcomm-transition);
}

.webcomm-preview-item:hover {
    transform: scale(1.02);
    box-shadow: var(--webcomm-shadow);
}

.webcomm-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.webcomm-preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: var(--webcomm-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--webcomm-transition);
}

.webcomm-preview-item:hover .webcomm-preview-remove {
    opacity: 1;
}

.webcomm-preview-remove:hover {
    background: var(--webcomm-error);
}

.webcomm-preview-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: var(--webcomm-white);
}

.webcomm-preview-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.webcomm-preview-size {
    font-size: 11px;
    opacity: 0.8;
}

/* Progress Section */
.webcomm-progress-section {
    margin-top: 24px;
    padding: 24px;
    background: var(--webcomm-gray-50);
    border-radius: var(--webcomm-radius);
    animation: fadeIn 0.3s ease-out;
}

.webcomm-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.webcomm-progress-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--webcomm-gray-800);
}

.webcomm-progress-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--webcomm-primary);
}

.webcomm-progress-bar-container {
    height: 12px;
    background: var(--webcomm-gray-200);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
}

.webcomm-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--webcomm-primary) 0%, var(--webcomm-secondary) 100%);
    border-radius: 6px;
    transition: width 0.3s ease-out;
    position: relative;
}

.webcomm-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.webcomm-progress-details {
    max-height: 200px;
    overflow-y: auto;
}

.webcomm-progress-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--webcomm-white);
    border-radius: var(--webcomm-radius-sm);
    margin-bottom: 8px;
    font-size: 13px;
}

.webcomm-progress-item:last-child {
    margin-bottom: 0;
}

.webcomm-progress-item-name {
    color: var(--webcomm-gray-700);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.webcomm-progress-item-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.webcomm-progress-item-savings {
    color: var(--webcomm-success);
    font-weight: 600;
}

.webcomm-progress-item-converting {
    color: var(--webcomm-primary);
}

.webcomm-progress-item-error {
    color: var(--webcomm-error);
}

/* Spinner */
.webcomm-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--webcomm-gray-200);
    border-top-color: var(--webcomm-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Results Section */
.webcomm-results-section {
    margin-top: 24px;
    padding: 32px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border-radius: var(--webcomm-radius);
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.webcomm-results-header {
    margin-bottom: 24px;
}

.webcomm-results-icon {
    margin-bottom: 16px;
}

.webcomm-results-header h3 {
    margin: 0 0 8px;
    font-size: 24px;
    font-weight: 700;
    color: var(--webcomm-gray-900);
}

.webcomm-results-header p {
    margin: 0;
    font-size: 15px;
    color: var(--webcomm-gray-600);
}

.webcomm-results-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.webcomm-stat {
    text-align: center;
}

.webcomm-stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--webcomm-primary);
}

.webcomm-stat-label {
    font-size: 13px;
    color: var(--webcomm-gray-500);
}

.webcomm-results-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Buttons */
.webcomm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--webcomm-radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--webcomm-transition);
    text-decoration: none;
}

.webcomm-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.webcomm-btn-primary {
    background: linear-gradient(135deg, var(--webcomm-primary) 0%, var(--webcomm-secondary) 100%);
    color: var(--webcomm-white);
}

.webcomm-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--webcomm-shadow-lg);
}

.webcomm-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.webcomm-btn-secondary {
    background: var(--webcomm-white);
    color: var(--webcomm-gray-700);
    border: 2px solid var(--webcomm-gray-200);
}

.webcomm-btn-secondary:hover {
    border-color: var(--webcomm-primary);
    color: var(--webcomm-primary);
}

.webcomm-btn-text {
    background: transparent;
    color: var(--webcomm-gray-500);
    padding: 8px 12px;
}

.webcomm-btn-text:hover {
    color: var(--webcomm-error);
}

.webcomm-btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

/* Actions Area */
.webcomm-actions {
    margin-top: 24px;
    text-align: center;
}

/* Footer */
.webcomm-footer {
    margin-top: 32px;
    text-align: center;
    padding: 24px;
}

.webcomm-footer p {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--webcomm-gray-500);
}

.webcomm-footer a {
    color: var(--webcomm-primary);
    text-decoration: none;
    font-weight: 600;
}

.webcomm-footer a:hover {
    text-decoration: underline;
}

.webcomm-footer-note {
    font-size: 13px;
    color: var(--webcomm-gray-400);
}

.webcomm-heart {
    color: var(--webcomm-error);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .webcomm-info-cards {
        grid-template-columns: 1fr;
    }
    
    .webcomm-card-info {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .webcomm-wrap {
        padding: 12px;
    }
    
    .webcomm-header {
        flex-direction: column;
        gap: 16px;
        padding: 20px;
        text-align: center;
    }
    
    .webcomm-logo {
        flex-direction: column;
        text-align: center;
    }
    
    .webcomm-brand h1 {
        font-size: 20px;
    }
    
    .webcomm-converter {
        padding: 20px;
    }
    
    .webcomm-converter-header h2 {
        font-size: 22px;
    }
    
    .webcomm-dropzone {
        padding: 40px 20px;
    }
    
    .webcomm-preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 12px;
    }
    
    .webcomm-results-stats {
        gap: 20px;
    }
    
    .webcomm-stat-value {
        font-size: 24px;
    }
    
    .webcomm-btn-lg {
        padding: 14px 24px;
        font-size: 15px;
        width: 100%;
    }
    
    .webcomm-results-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .webcomm-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .webcomm-progress-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .webcomm-progress-item-name {
        max-width: 100%;
    }
    
    .webcomm-quality-control {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .webcomm-range {
        width: 100%;
    }
}

/* Dark mode support (optional - follows WP admin) */
@media (prefers-color-scheme: dark) {
    .webcomm-wrap {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    /* Add dark mode styles if needed */
}

/* Print styles */
@media print {
    .webcomm-wrap {
        background: white;
    }
    
    .webcomm-dropzone,
    .webcomm-actions,
    .webcomm-btn {
        display: none;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .webcomm-wrap *,
    .webcomm-wrap *::before,
    .webcomm-wrap *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
.webcomm-btn:focus-visible,
.webcomm-file-input:focus-visible + .webcomm-dropzone-content,
.webcomm-range:focus-visible {
    outline: 2px solid var(--webcomm-primary);
    outline-offset: 2px;
}

/* ==========================================
   FRONTEND SPECIFIC STYLES
   ========================================== */

.webcomm-frontend {
    padding: 0;
    background: transparent;
    min-height: auto;
}

.webcomm-frontend .webcomm-container {
    max-width: 100%;
}

.webcomm-frontend .webcomm-header {
    border-radius: var(--webcomm-radius);
    margin-bottom: 20px;
}

.webcomm-frontend .webcomm-header h2 {
    font-size: 22px;
    margin: 0;
}

.webcomm-frontend .webcomm-converter {
    border-radius: var(--webcomm-radius);
}

.webcomm-frontend .webcomm-footer {
    margin-top: 20px;
    padding: 16px;
}

/* ==========================================
   DARK THEME
   ========================================== */

.webcomm-theme-dark {
    --webcomm-gray-50: #1F2937;
    --webcomm-gray-100: #374151;
    --webcomm-gray-200: #4B5563;
    --webcomm-gray-300: #6B7280;
    --webcomm-gray-400: #9CA3AF;
    --webcomm-gray-500: #D1D5DB;
    --webcomm-gray-600: #E5E7EB;
    --webcomm-gray-700: #F3F4F6;
    --webcomm-gray-800: #F9FAFB;
    --webcomm-gray-900: #FFFFFF;
    --webcomm-white: #111827;
}

.webcomm-theme-dark .webcomm-wrap {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
}

.webcomm-theme-dark .webcomm-header,
.webcomm-theme-dark .webcomm-card,
.webcomm-theme-dark .webcomm-converter {
    background: #1F2937;
    border: 1px solid #374151;
}

.webcomm-theme-dark .webcomm-dropzone {
    background: #111827;
    border-color: #4B5563;
}

.webcomm-theme-dark .webcomm-dropzone:hover,
.webcomm-theme-dark .webcomm-dropzone.dragover {
    border-color: var(--webcomm-primary);
    background: rgba(99, 102, 241, 0.1);
}

.webcomm-theme-dark .webcomm-settings {
    background: #111827;
}

.webcomm-theme-dark .webcomm-progress-section {
    background: #111827;
}

.webcomm-theme-dark .webcomm-progress-item {
    background: #1F2937;
}

.webcomm-theme-dark .webcomm-preview-item {
    background: #374151;
}

.webcomm-theme-dark .webcomm-formats {
    background: #374151;
    color: var(--webcomm-gray-400);
}

.webcomm-theme-dark .webcomm-btn-secondary {
    background: #374151;
    border-color: #4B5563;
    color: #E5E7EB;
}

.webcomm-theme-dark .webcomm-btn-secondary:hover {
    border-color: var(--webcomm-primary);
    color: var(--webcomm-primary-light);
}

.webcomm-theme-dark .webcomm-results-section {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
}

.webcomm-theme-dark .webcomm-footer p,
.webcomm-theme-dark .webcomm-footer-note {
    color: #9CA3AF;
}

.webcomm-theme-dark .webcomm-status-success {
    background: rgba(16, 185, 129, 0.2);
    color: #34D399;
}

.webcomm-theme-dark .webcomm-status-error {
    background: rgba(239, 68, 68, 0.2);
    color: #F87171;
}

.webcomm-theme-dark .webcomm-range {
    background: #374151;
}

.webcomm-theme-dark .webcomm-version {
    background: #374151;
    color: #9CA3AF;
}
