/**
 * DGA Status Toggle Shortcode Styles
 *
 * iOS/Airbnb-style toggle switch for [post_status_toggle] shortcode
 * Active/Inactive status toggle with smooth animations
 *
 * @package DGA_Post_Editor
 * @version 2.0.0
 * @requires dgape-design-tokens.css
 *
 * Class naming convention preserved for JavaScript compatibility:
 * - .at-status-toggle-* classes
 */

/* ========================================
   MAIN CONTAINER
   ======================================== */
.at-status-toggle-container {
    display: inline-flex;
    align-items: center;
    gap: var(--dgape-space-3);
    padding: var(--dgape-space-2);
    font-family: var(--dgape-font-family);
}

/* ========================================
   TOGGLE SWITCH (iOS Style)
   ======================================== */
.at-status-toggle-switch {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 32px;
    background-color: var(--dgape-gray-300);
    border-radius: var(--dgape-radius-full);
    cursor: pointer;
    transition: background-color var(--dgape-transition-normal),
                box-shadow var(--dgape-transition-normal);
    flex-shrink: 0;
}

/* Focus state for keyboard navigation */
.at-status-toggle-switch:focus {
    outline: none;
    box-shadow: var(--dgape-shadow-focus);
}

.at-status-toggle-switch:focus-visible {
    box-shadow: var(--dgape-shadow-focus);
}

/* Hover state */
.at-status-toggle-switch:hover {
    box-shadow: var(--dgape-shadow-sm);
}

/* Active state (Green) */
.at-status-toggle-switch.active {
    background-color: var(--dgape-success);
}

/* Inactive state (Red) */
.at-status-toggle-switch.inactive {
    background-color: var(--dgape-error);
}

/* Loading state */
.at-status-toggle-switch.loading {
    opacity: 0.6;
    pointer-events: none;
}

.at-status-toggle-switch.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: dgape-spin 0.8s linear infinite;
    z-index: 2;
}

/* ========================================
   TOGGLE SLIDER (Thumb)
   ======================================== */
.at-status-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 26px;
    height: 26px;
    background-color: var(--dgape-bg-primary);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2),
                0 0 0 1px rgba(0, 0, 0, 0.04);
    transition: transform var(--dgape-transition-normal);
    z-index: 1;
}

/* Move slider to right when active */
.at-status-toggle-switch.active .at-status-toggle-slider {
    transform: translateX(24px);
}

/* ========================================
   STATUS LABEL
   ======================================== */
.at-status-toggle-label {
    font-size: var(--dgape-text-sm);
    font-weight: var(--dgape-font-semibold);
    color: var(--dgape-text-primary);
    min-width: 60px;
    user-select: none;
    transition: var(--dgape-transition-color);
}

/* Label color based on status */
.at-status-toggle-container[data-status="active"] .at-status-toggle-label {
    color: var(--dgape-success-dark);
}

.at-status-toggle-container[data-status="inactive"] .at-status-toggle-label {
    color: var(--dgape-error-dark);
}

/* ========================================
   MESSAGE AREA
   ======================================== */
.at-status-toggle-message {
    font-size: var(--dgape-text-xs);
    min-height: 20px;
    transition: var(--dgape-transition-opacity);
}

.at-status-toggle-message:empty {
    display: none;
}

.at-status-toggle-message .success {
    display: inline-flex;
    align-items: center;
    gap: var(--dgape-space-1);
    padding: var(--dgape-space-1) var(--dgape-space-2);
    color: var(--dgape-success-dark);
    background-color: var(--dgape-success-light);
    border-radius: var(--dgape-radius-sm);
    animation: dgape-fadeIn var(--dgape-transition-normal) ease;
}

.at-status-toggle-message .error {
    display: inline-flex;
    align-items: center;
    gap: var(--dgape-space-1);
    padding: var(--dgape-space-1) var(--dgape-space-2);
    color: var(--dgape-error-dark);
    background-color: var(--dgape-error-light);
    border-radius: var(--dgape-radius-sm);
    animation: dgape-fadeIn var(--dgape-transition-normal) ease;
}

/* ========================================
   COMPACT VARIANT
   ======================================== */
.at-status-toggle-container.compact {
    gap: var(--dgape-space-2);
}

.at-status-toggle-container.compact .at-status-toggle-switch {
    width: 44px;
    height: 24px;
}

.at-status-toggle-container.compact .at-status-toggle-slider {
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
}

.at-status-toggle-container.compact .at-status-toggle-switch.active .at-status-toggle-slider {
    transform: translateX(20px);
}

.at-status-toggle-container.compact .at-status-toggle-label {
    font-size: var(--dgape-text-xs);
}

/* ========================================
   DISABLED STATE
   ======================================== */
.at-status-toggle-container.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.at-status-toggle-container.disabled .at-status-toggle-switch {
    cursor: not-allowed;
}

/* ========================================
   WITH CARD WRAPPER
   ======================================== */
.at-status-toggle-card {
    display: inline-flex;
    align-items: center;
    gap: var(--dgape-space-3);
    padding: var(--dgape-space-3) var(--dgape-space-4);
    background-color: var(--dgape-bg-primary);
    border: 1px solid var(--dgape-border-light);
    border-radius: var(--dgape-radius-lg);
    box-shadow: var(--dgape-shadow-xs);
    transition: var(--dgape-transition-all);
}

.at-status-toggle-card:hover {
    border-color: var(--dgape-border-default);
    box-shadow: var(--dgape-shadow-sm);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 480px) {
    .at-status-toggle-container {
        flex-wrap: wrap;
        gap: var(--dgape-space-2);
    }

    .at-status-toggle-label {
        min-width: auto;
    }

    .at-status-toggle-message {
        flex-basis: 100%;
        margin-top: var(--dgape-space-1);
    }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */
@media (prefers-color-scheme: dark) {
    .at-status-toggle-switch {
        background-color: var(--dgape-gray-600);
    }

    .at-status-toggle-switch.active {
        background-color: var(--dgape-success);
    }

    .at-status-toggle-switch.inactive {
        background-color: var(--dgape-error);
    }

    .at-status-toggle-slider {
        background-color: var(--dgape-gray-100);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    }

    .at-status-toggle-label {
        color: var(--dgape-text-primary);
    }

    .at-status-toggle-card {
        background-color: var(--dgape-bg-secondary);
        border-color: var(--dgape-border-default);
    }

    .at-status-toggle-message .success {
        background-color: rgba(82, 196, 26, 0.15);
    }

    .at-status-toggle-message .error {
        background-color: rgba(255, 77, 79, 0.15);
    }
}

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */
@media (prefers-contrast: high) {
    .at-status-toggle-switch {
        border: 2px solid var(--dgape-text-primary);
    }

    .at-status-toggle-switch:focus {
        outline: 3px solid var(--dgape-text-primary);
        outline-offset: 2px;
    }

    .at-status-toggle-slider {
        border: 2px solid var(--dgape-text-primary);
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .at-status-toggle-switch,
    .at-status-toggle-slider,
    .at-status-toggle-label,
    .at-status-toggle-message .success,
    .at-status-toggle-message .error {
        transition: none;
        animation: none;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .at-status-toggle-container {
        display: none;
    }
}

/* ========================================
   ANIMATION KEYFRAMES
   ======================================== */
@keyframes dgape-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes dgape-fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
