/* Batch Trash Cleaner Admin Styles - v3.1 Optimized */

/* Performance optimizations */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Reduce paint/layout thrashing */
.btc-container {
    contain: layout style;
    will-change: auto;
}

/* GPU acceleration for animations */
.btc-status-indicator.running,
.btc-progress-bar,
.btc-alert-box {
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* Optimize font loading */
.btc-container {
    font-display: swap;
}

:root {
    /* Color palette - organized by usage */
    --btc-primary: #2271b1;
    --btc-primary-dark: #135e96;
    --btc-primary-light: #72aee6;
    --btc-secondary: #6c28d9;
    --btc-secondary-light: #8b5cf6;
    
    /* Semantic colors */
    --btc-success: #00a32a;
    --btc-success-light: #e0f5e9;
    --btc-error: #d63638;
    --btc-error-light: #fcf0f1;
    --btc-warning: #f0b849;
    --btc-warning-light: #fcf9e8;
    --btc-info: #1f618d;
    --btc-info-light: #d6eaf8;
    
    /* Neutral colors */
    --btc-white: #fff;
    --btc-border: #dcdcde;
    --btc-light-bg: #f6f7f7;
    --btc-light-bg2: #f0f0f1;
    --btc-text: #1d2327;
    --btc-text-secondary: #646970;
    
    /* Spacing scale - T-shirt sizes */
    --btc-space-xs: 4px;
    --btc-space-sm: 8px;
    --btc-space-md: 15px;
    --btc-space-lg: 25px;
    --btc-space-xl: 30px;
    
    /* Border radius scale */
    --btc-radius-sm: 2px;
    --btc-radius-md: 4px;
    --btc-radius-lg: 8px;
    --btc-radius-xl: 16px;
    
    /* Shadow system */
    --btc-shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --btc-shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --btc-shadow-lg: 0 4px 12px rgba(0,0,0,0.12);
    --btc-shadow-xl: 0 8px 24px rgba(0,0,0,0.15);
    
    /* Typography scale */
    --btc-font-size-xs: 11px;
    --btc-font-size-sm: 12px;
    --btc-font-size-md: 14px;
    --btc-font-size-lg: 16px;
    --btc-font-size-xl: 18px;
    --btc-font-size-2xl: 24px;
    
    /* Transition system */
    --btc-transition-fast: 0.2s;
    --btc-transition-normal: 0.3s;
    --btc-transition-slow: 0.5s;
    
    /* Z-index scale */
    --btc-z-dropdown: 1000;
    --btc-z-modal: 1050;
    --btc-z-alert: 9999;
}

/* Base styles */
.btc-container {
    max-width: 1200px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Status Header */
.btc-status-header {
    background: linear-gradient(135deg, var(--btc-primary) 0%, var(--btc-primary-dark) 100%);
    border-radius: var(--btc-radius-lg);
    color: var(--btc-white);
    padding: var(--btc-space-lg);
    margin-bottom: var(--btc-space-lg);
    display: grid;
    grid-template-columns: 50px 1fr 1fr;
    gap: var(--btc-space-lg);
    box-shadow: var(--btc-shadow-md);
    position: relative;
    overflow: hidden;
}

.btc-status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btc-status-icon .dashicons {
    font-size: 36px;
    width: 36px;
    height: 36px;
}

.btc-status-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.btc-status-title h1 {
    margin: 0;
    padding: 0;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--btc-white);
}

.btc-status-pill {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 4px 10px;
    margin-top: 5px;
    font-size: 12px;
    font-weight: 500;
    width: fit-content;
}

.btc-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--btc-light-bg);
    margin-right: 6px;
    display: inline-block;
}

.btc-status-indicator.running {
    background-color: var(--btc-success);
    box-shadow: 0 0 0 2px rgba(0, 163, 42, 0.3);
    animation: btc-pulse 1.5s infinite;
}

/* Optimized animations with reduced motion support */
@keyframes btc-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 163, 42, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(0, 163, 42, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 163, 42, 0);
    }
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translate3d(0, 10px, 0); 
    }
    to { 
        opacity: 1; 
        transform: translate3d(0, 0, 0); 
    }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes btc-shimmer {
    0% { transform: translate3d(-100%, 0, 0); }
    100% { transform: translate3d(100%, 0, 0); }
}

/* Respect user preferences for reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .btc-status-indicator.running {
        animation: none;
    }
}

.btc-status-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--btc-spacing);
}

.btc-status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: var(--btc-border-radius);
    text-align: center;
    flex: 1;
}

.btc-status-item .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
    margin-bottom: 5px;
}

.btc-status-item span:nth-child(2) {
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 3px;
}

.btc-status-label {
    font-size: 11px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btc-status-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: rgba(0, 0, 0, 0.15);
}

.btc-status-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.4) 100%);
    width: 0%;
    transition: width 0.5s ease-in-out;
}

.btc-status-countdown {
    position: absolute;
    right: var(--btc-spacing-lg);
    bottom: 5px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btc-status-countdown .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

/* Tab Navigation */
.btc-tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--btc-border);
    margin-bottom: 20px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    scrollbar-color: var(--btc-border) transparent;
}

.btc-tabs-nav::-webkit-scrollbar {
    height: 4px;
}

.btc-tabs-nav::-webkit-scrollbar-track {
    background: transparent;
}

.btc-tabs-nav::-webkit-scrollbar-thumb {
    background-color: var(--btc-border);
    border-radius: 4px;
}

.btc-tab-button {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-right: 10px;
    cursor: pointer;
    font-weight: 500;
    color: var(--btc-text-secondary);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.btc-tab-button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    transition: all 0.2s ease;
}

.btc-tab-button:hover {
    color: var(--btc-primary-dark);
}

.btc-tab-button:hover .dashicons {
    transform: translateY(-2px);
}

.btc-tab-button.active {
    border-bottom-color: var(--btc-primary);
    color: var(--btc-text);
}

.btc-tab-button.active .dashicons {
    color: var(--btc-primary);
}

.btc-tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.btc-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Alert Box - Removed duplicate, keeping enhanced version below */

/* Main UI Elements */
.btc-section {
    background: var(--btc-white);
    border-radius: var(--btc-border-radius-lg);
    box-shadow: var(--btc-shadow);
    margin-bottom: var(--btc-spacing-xl);
    padding: var(--btc-spacing-lg);
    position: relative;
    overflow: hidden;
}

.btc-section-header {
    margin-bottom: var(--btc-spacing-lg);
}

.btc-section-header h2, 
.btc-section-header h3 {
    margin-top: 0;
    padding-top: 0;
    border-bottom: 1px solid var(--btc-border);
    padding-bottom: 12px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btc-section-header .dashicons {
    color: var(--btc-primary);
}

.btc-section-description {
    color: var(--btc-text-secondary);
    margin-top: 5px;
    margin-bottom: 15px;
}

/* Settings Grid */
.btc-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: var(--btc-spacing-lg);
}

.btc-settings-group {
    margin-bottom: 20px;
}

.btc-settings-group label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--btc-spacing-sm);
    color: var(--btc-text);
}

.btc-settings-group input[type="text"],
.btc-settings-group input[type="number"],
.btc-settings-group input[type="datetime-local"],
.btc-settings-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--btc-border);
    border-radius: var(--btc-border-radius);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.btc-settings-group input:focus, 
.btc-settings-group select:focus {
    border-color: var(--btc-primary);
    box-shadow: 0 0 0 1px var(--btc-primary);
    outline: none;
}

.btc-settings-group .description {
    color: var(--btc-text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* Stats Cards */
.btc-stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--btc-spacing);
    margin-bottom: var(--btc-spacing-lg);
}

.btc-stats-card {
    background: var(--btc-light-bg);
    border-radius: var(--btc-border-radius);
    padding: var(--btc-spacing);
    display: flex;
    align-items: center;
    gap: var(--btc-spacing);
    transition: all 0.3s ease;
    box-shadow: var(--btc-shadow-sm);
}

.btc-stats-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--btc-shadow);
}

.btc-stats-icon {
    background: var(--btc-primary);
    color: var(--btc-white);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btc-stats-icon .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.btc-stats-content {
    flex: 1;
}

.btc-stats-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--btc-text);
    line-height: 1.2;
}

.btc-stats-label {
    font-size: 12px;
    color: var(--btc-text-secondary);
}

/* Progress Bar */
.btc-progress-container {
    margin-top: var(--btc-spacing-lg);
    margin-bottom: var(--btc-spacing-lg);
    background: var(--btc-light-bg);
    border-radius: var(--btc-border-radius);
    padding: var(--btc-spacing);
}

.btc-progress-container h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 16px;
}

.btc-progress-container h3 .dashicons {
    color: var(--btc-primary);
}

.btc-progress-wrapper {
    background-color: var(--btc-white);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.btc-progress-bar {
    background: linear-gradient(90deg, var(--btc-primary) 0%, var(--btc-primary-light) 100%);
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease-in-out;
    position: relative;
    overflow: hidden;
}

.btc-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: btc-shimmer 2s infinite;
}

@keyframes btc-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.btc-progress-details {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--btc-text-secondary);
}

/* Chart Container */
.btc-chart-container {
    background: var(--btc-white);
    border-radius: var(--btc-border-radius);
    padding: var(--btc-spacing);
    margin-bottom: var(--btc-spacing-lg);
    height: 300px;
    box-shadow: var(--btc-shadow-sm);
}

/* Action Buttons */
.btc-actions {
    margin-top: var(--btc-spacing-lg);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btc-actions .button {
    display: flex;
    align-items: center;
    gap: 5px;
}

.btc-actions .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Loading Spinner */
.btc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 30px 0;
    text-align: center;
}

.btc-spinner-container {
    margin-bottom: 15px;
}

.btc-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--btc-primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btc-loading p {
    color: var(--btc-text-secondary);
    margin: 0;
}

/* Table Styles */
.btc-table-container {
    margin-bottom: var(--btc-spacing-lg);
    overflow-x: auto;
}

.btc-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    margin-bottom: var(--btc-spacing);
    background: var(--btc-white);
    border-radius: var(--btc-border-radius);
    overflow: hidden;
    box-shadow: var(--btc-shadow-sm);
}

.btc-table th {
    text-align: left;
    padding: 12px 15px;
    background: var(--btc-light-bg);
    font-weight: 600;
    color: var(--btc-text);
    border-bottom: 1px solid var(--btc-border);
}

.btc-table td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--btc-border);
    color: var(--btc-text);
}

.btc-table tr:last-child td {
    border-bottom: none;
}

.btc-table tr:nth-child(even) {
    background-color: var(--btc-light-bg);
}

.btc-table tr:hover {
    background-color: rgba(34, 113, 177, 0.05);
}

/* Optimized responsive design with modern CSS */
@media screen and (max-width: 782px) {
    .btc-status-header {
        grid-template-columns: 1fr;
        gap: var(--btc-space-md);
    }
    
    .btc-status-icon {
        display: none;
    }
    
    .btc-status-info {
        flex-wrap: wrap;
        gap: var(--btc-space-sm);
    }
    
    .btc-settings-grid {
        grid-template-columns: 1fr;
        gap: var(--btc-space-md);
    }
    
    .btc-stats-cards {
        grid-template-columns: 1fr;
        gap: var(--btc-space-sm);
    }
    
    .btc-tab-button {
        padding: var(--btc-space-sm) var(--btc-space-md);
    }
    
    .btc-tab-button .dashicons {
        margin-right: 0;
    }
    
    .btc-tab-button span:not(.dashicons) {
        display: none;
    }
    
    .btc-actions {
        flex-wrap: wrap;
        gap: var(--btc-space-sm);
    }
    
    .btc-actions .button {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .btc-alert-box {
        max-width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        transform: translateY(100%);
    }
    
    .btc-alert-box.active {
        transform: translateY(0);
    }
}

/* High DPI displays optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btc-container {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Consolidated utility classes for better maintainability */
.btc-flex {
    display: flex;
}

.btc-flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.btc-flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btc-flex-column {
    display: flex;
    flex-direction: column;
}

.btc-flex-gap {
    gap: var(--btc-space-md);
}

.btc-text-center {
    text-align: center;
}

.btc-transition {
    transition: all var(--btc-transition-normal) ease;
}

.btc-shadow {
    box-shadow: var(--btc-shadow-md);
}

.btc-radius {
    border-radius: var(--btc-radius-md);
}

/* Enhanced Alert System with better organization */
.btc-alert-box {
    position: fixed;
    top: 32px;
    right: 20px;
    max-width: 400px;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    line-height: 1.5;
    z-index: 9999;
    transition: all 0.3s ease;
    transform: translateX(100%);
    opacity: 0;
    position: relative;
    overflow: hidden;
}

.btc-alert-box.active {
    transform: translateX(0);
    opacity: 1;
}

.btc-alert-box.success {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
}

.btc-alert-box.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.btc-alert-box.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
}

.btc-alert-box.info {
    background: #d6eaf8;
    border: 1px solid #aed6f1;
    color: #1f618d;
}

.btc-alert-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.2);
    width: 0;
    transition: width linear;
}

.btc-alert-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.btc-alert-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.btc-error-list {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.btc-error-list li {
    margin: 4px 0;
}