/* Utility
---------------------------------------- */
.wsacsc-is-hidden {
    display: none !important;
}

/* Theme tokens (WordPress admin CSS variables with fallbacks)
---------------------------------------- */
.wsacsc-cleaner {
    --wsacsc-primary: var(--wp-admin-theme-color, #2271b1);
    --wsacsc-primary-dark: var(--wp-admin-theme-color-darker-10, #135e96);
    --wsacsc-text: var(--wp-components-color-foreground, #1e1e1e);
    --wsacsc-text-muted: #646970;
    --wsacsc-surface: #fff;
    --wsacsc-surface-alt: #f6f7f7;
    --wsacsc-border: #c3c4c7;
    --wsacsc-input-border: #8c8f94;
    --wsacsc-info-bg: #f0f6fc;
    --wsacsc-success-bg: #edfaef;
    --wsacsc-success-border: #00a32a;
    --wsacsc-success-text: #00701a;
    --wsacsc-error-bg: #fcf0f1;
    --wsacsc-error-border: #d63638;
    --wsacsc-error-text: #8c0b10;
    --wsacsc-disabled: #a7aaad;
}

/* Main container styles
---------------------------------------- */
.wsacsc-cleaner {
    max-width: 800px;
    margin: 20px auto;
    background: var(--wsacsc-surface);
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* Typography
---------------------------------------- */
.wsacsc-cleaner h1 {
    color: var(--wsacsc-text);
    border-bottom: 2px solid var(--wsacsc-primary);
    padding-bottom: 10px;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
}

.wsacsc-section h2 {
    color: var(--wsacsc-text);
    font-size: 20px;
    font-weight: 500;
    margin: 0 0 15px 0;
}

/* Info box styles
---------------------------------------- */
.wsacsc-info {
    background: var(--wsacsc-info-bg);
    border-left: 4px solid var(--wsacsc-primary);
    padding: 15px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 1.5;
}

.wsacsc-info ul {
    margin: 10px 0 0 20px;
}

.wsacsc-info ul li {
    margin-bottom: 5px;
}

.wsacsc-info ul li:last-child {
    margin-bottom: 0;
}

/* Section containers
---------------------------------------- */
.wsacsc-section {
    background: var(--wsacsc-surface-alt);
    border: 1px solid var(--wsacsc-border);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 3px;
}

.wsacsc-section p {
    margin: 0 0 15px 0;
}

.wsacsc-section > *:last-child {
    margin-bottom: 0;
}

/* Button styles and containers
---------------------------------------- */
.wsacsc-optimize-buttons,
.wsacsc-options {
    display: flex;
    gap: 10px;
}

.wsacsc-cleaner .button-primary,
.wsacsc-cleaner .button-secondary {
    background-color: var(--wsacsc-primary);
    color: var(--wsacsc-surface);
    border: 1px solid var(--wsacsc-primary);
    font-size: 14px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wsacsc-cleaner .button-primary:hover,
.wsacsc-cleaner .button-secondary:hover {
    background-color: var(--wsacsc-primary-dark);
    border-color: var(--wsacsc-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
	color: var(--wsacsc-surface);
}

.wsacsc-cleaner .button-primary:focus-visible,
.wsacsc-cleaner .button-secondary:focus-visible {
    outline: 2px solid var(--wsacsc-primary);
    outline-offset: 2px;
}

.wsacsc-cleaner .button-primary:active,
.wsacsc-cleaner .button-secondary:active {
    transform: translateY(0);
    box-shadow: none;
}

.wsacsc-cleaner .button-primary:disabled,
.wsacsc-cleaner .button-secondary:disabled {
    background-color: var(--wsacsc-disabled) !important;
    border-color: var(--wsacsc-disabled) !important;
    color: var(--wsacsc-surface-alt) !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    transition: all 0.3s ease;
}

/* Message styles
---------------------------------------- */
.wsacsc-message {
    padding: 10px 15px;
    border-radius: 3px;
    font-size: 14px;
    line-height: 1.4;
    display: none;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* When message is shown, ensure proper display and fade in */
.wsacsc-message.success,
.wsacsc-message.error,
.wsacsc-message.info {
    display: flex;
    opacity: 1;
    margin-top: 15px;
}

/* Message types with transitions */
.wsacsc-message.success {
    background: var(--wsacsc-success-bg);
    border: 1px solid var(--wsacsc-success-border);
    color: var(--wsacsc-success-text);
}

.wsacsc-message.error {
    background: var(--wsacsc-error-bg);
    border: 1px solid var(--wsacsc-error-border);
    color: var(--wsacsc-error-text);
}

.wsacsc-message.info {
    background: var(--wsacsc-info-bg);
    border: 1px solid var(--wsacsc-primary);
    color: var(--wsacsc-primary-dark);
    font-style: italic;
}

.wsacsc-message.info::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 10px;
    border: 2px solid var(--wsacsc-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: wsacsc-spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Message fade out */
.wsacsc-message.fade-out {
    opacity: 0;
}

/* Form elements
---------------------------------------- */
.wsacsc-section input[type="number"] {
    width: 60px;
    padding: 5px 8px;
    border: 1px solid var(--wsacsc-input-border);
    border-radius: 3px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.wsacsc-section input[type="number"]:focus {
    border-color: var(--wsacsc-primary);
    box-shadow: 0 0 0 1px var(--wsacsc-primary);
}

.wsacsc-section input[type="number"]:focus-visible,
.wsacsc-section input[type="time"]:focus-visible {
    outline: 2px solid var(--wsacsc-primary);
    outline-offset: 0;
}

.wsacsc-section input[type="number"].wsacsc-field-error,
.wsacsc-section input[type="time"].wsacsc-field-error {
    border-color: var(--wsacsc-error-border);
    background-color: var(--wsacsc-error-bg);
    box-shadow: 0 0 0 1px var(--wsacsc-error-border);
}

.wsacsc-section input[type="number"].wsacsc-field-error:focus,
.wsacsc-section input[type="time"].wsacsc-field-error:focus {
    border-color: var(--wsacsc-error-border);
    box-shadow: 0 0 0 1px var(--wsacsc-error-border);
}

/* Checkbox styles */
.wsacsc-options {
    border: 0;
    margin: 0 0 15px 0;
    padding: 0;
}

.wsacsc-options legend.screen-reader-text {
    margin: 0;
}

.wsacsc-options label {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 10px;
    cursor: pointer;
}

/* Powered-by styles */
.wsacsc-powered-by {
    margin-top: 5px;
    margin-left: 5px;
    font-size: 12px;
    font-style: italic;
    color: var(--wsacsc-text-muted);
}

.wsacsc-powered-by a {
    display: inline-flex;
    align-items: center;
    color: var(--wsacsc-primary);
    text-decoration: none;
}

.wsacsc-powered-by a:hover {
    color: var(--wsacsc-primary-dark);
    text-decoration: none;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.wsacsc-powered-by img {
    margin-right: 5px;
    transition: all 0.3s ease;
}

.wsacsc-powered-by a:hover img {
    transform: scale(1.1);
}

/* Refresh control styles
---------------------------------------- */
.wsacsc-refresh.button-link {
    vertical-align: middle;
    margin-left: 5px;
    padding: 0;
    min-height: auto;
    line-height: 1;
    color: var(--wsacsc-primary);
    transition: color 0.3s ease, transform 0.3s ease;
	text-decoration: none;
}

.wsacsc-refresh.button-link:hover {
    color: var(--wsacsc-primary-dark);
    transform: rotate(180deg);
}

.wsacsc-refresh.button-link:focus-visible {
    outline: 2px solid var(--wsacsc-primary);
    outline-offset: 2px;
    box-shadow: none;
}

.wsacsc-refresh.spin .dashicons {
    animation: spin 1s linear infinite;
}

/* Animations
---------------------------------------- */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes wsacsc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wsacsc-fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Scheduling options
---------------------------------------- */
.wsacsc-scheduling-options {
    margin-bottom: 15px;
}

.wsacsc-scheduling-group {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--wsacsc-surface);
    border: 1px solid var(--wsacsc-border);
    border-radius: 3px;
}

.wsacsc-scheduling-group:last-child {
    margin-bottom: 0;
}

.wsacsc-scheduling-group h3 {
    color: var(--wsacsc-text);
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--wsacsc-border);
}

.wsacsc-scheduling-option {
    margin-bottom: 15px;
}

.wsacsc-scheduling-option:last-child {
    margin-bottom: 0;
}

.wsacsc-scheduling-option label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.wsacsc-scheduling-option .input-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

.wsacsc-scheduling-option .description {
    font-size: 12px;
    color: var(--wsacsc-text-muted);
    margin: 5px 0 0 0;
    font-style: italic;
}

.wsacsc-section input[type="time"] {
    padding: 5px 8px;
    border: 1px solid var(--wsacsc-input-border);
    border-radius: 3px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.wsacsc-section input[type="time"]:focus {
    border-color: var(--wsacsc-primary);
    box-shadow: 0 0 0 1px var(--wsacsc-primary);
}

/* Reduced motion
---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .wsacsc-cleaner .button-primary,
    .wsacsc-cleaner .button-secondary,
    .wsacsc-refresh.button-link,
    .wsacsc-powered-by a,
    .wsacsc-powered-by img,
    .wsacsc-message {
        transition: none;
    }

    .wsacsc-cleaner .button-primary:hover,
    .wsacsc-cleaner .button-secondary:hover {
        transform: none;
    }

    .wsacsc-refresh.button-link:hover {
        transform: none;
    }

    .wsacsc-refresh.spin .dashicons,
    .wsacsc-message.info::before {
        animation: none;
    }
}

/* Responsive design
---------------------------------------- */
@media only screen and (max-width: 600px) {
    .wsacsc-cleaner {
        margin: 10px;
        padding: 15px;
    }

    .wsacsc-cleaner h1 {
        font-size: 24px;
    }

    .wsacsc-section h2 {
        font-size: 18px;
    }

    .wsacsc-optimize-buttons,
    .wsacsc-options {
        flex-direction: column;
        margin-bottom: 15px;
    }

    .wsacsc-cleaner .button-primary,
    .wsacsc-cleaner .button-secondary {
        width: 100%;
        margin-bottom: 10px;
    }
}
