/* =============================================================================
   table-runtime.canonical-sync-ui.css
   Estilos para la UI de Cloud Sync
   ============================================================================= */

/* ── Indicador de header ───────────────────────────────────────────────────── */

.sync-indicator-container {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-indicator {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(129, 233, 255, 0.08);
    background: rgba(15, 25, 48, 0.70);
    color: #a3aac4;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sync-indicator:hover {
    background: rgba(129, 233, 255, 0.12);
    border-color: rgba(129, 233, 255, 0.25);
    color: #81e9ff;
    transform: scale(1.05);
}

.sync-indicator:active {
    transform: scale(0.95);
}

/* Estados del indicador */
.sync-indicator.sync-status-idle {
    background: rgba(15, 25, 48, 0.70);
    border-color: rgba(129, 233, 255, 0.08);
    color: #a3aac4;
}

.sync-indicator.sync-status-pending {
    background: rgba(25, 115, 80, 0.70);
    border-color: rgba(105, 246, 184, 0.30);
    color: #69f6b8;
}

.sync-indicator.sync-status-pending .material-symbols-outlined {
    animation: pulse 2s infinite;
}

.sync-indicator.sync-status-syncing {
    background: rgba(0, 105, 119, 0.70);
    border-color: rgba(129, 233, 255, 0.30);
    color: #81e9ff;
}

.sync-indicator.sync-status-syncing .material-symbols-outlined {
    animation: spin 1s linear infinite;
}

.sync-indicator.sync-status-synced {
    background: rgba(35, 60, 60, 0.70);
    border-color: rgba(105, 246, 184, 0.40);
    color: #69f6b8;
}

.sync-indicator.sync-status-error {
    background: rgba(80, 20, 20, 0.70);
    border-color: rgba(255, 113, 108, 0.40);
    color: #ff716c;
}

.sync-indicator.sync-status-offline {
    background: rgba(30, 30, 30, 0.70);
    border-color: rgba(163, 170, 196, 0.20);
    color: #5a6480;
}

/* Botón "Sincronizar ahora" flotante */
.sync-button {
    position: absolute;
    top: 48px;
    right: 0;
    padding: 8px 16px;
    border-radius: 8px;
    background: rgba(129, 233, 255, 0.08);
    border: 1px solid rgba(129, 233, 255, 0.15);
    color: #81e9ff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-button:hover:not(:disabled) {
    background: rgba(129, 233, 255, 0.15);
    border-color: rgba(129, 233, 255, 0.30);
    color: #81e9ff;
}

.sync-button:active:not(:disabled) {
    transform: scale(0.98);
}

.sync-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Panel lateral de sincronización ────────────────────────────────────────── */

.sync-sidebar-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sync-panel__content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* Cabecera del panel */
.sync-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(129, 233, 255, 0.08);
}

.sync-panel__header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sync-panel__header-icon {
    font-size: 20px;
    color: #81e9ff;
}

.sync-panel__header-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #dee5ff;
    margin: 0;
}

.sync-panel__status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
}

.sync-panel__status-badge.sync-status-idle {
    background: rgba(15, 25, 48, 0.50);
    border: 1px solid rgba(129, 233, 255, 0.08);
    color: #a3aac4;
}

.sync-panel__status-badge.sync-status-pending {
    background: rgba(25, 115, 80, 0.20);
    border: 1px solid rgba(105, 246, 184, 0.30);
    color: #69f6b8;
}

.sync-panel__status-badge.sync-status-pending .sync-badge-icon {
    animation: pulse 2s infinite;
}

.sync-panel__status-badge.sync-status-syncing {
    background: rgba(0, 105, 119, 0.20);
    border: 1px solid rgba(129, 233, 255, 0.30);
    color: #81e9ff;
}

.sync-panel__status-badge.sync-status-syncing .sync-badge-icon {
    animation: spin 1s linear infinite;
}

.sync-panel__status-badge.sync-status-synced {
    background: rgba(35, 60, 60, 0.20);
    border: 1px solid rgba(105, 246, 184, 0.40);
    color: #69f6b8;
}

.sync-panel__status-badge.sync-status-error {
    background: rgba(80, 20, 20, 0.20);
    border: 1px solid rgba(255, 113, 108, 0.40);
    color: #ff716c;
}

.sync-panel__status-badge.sync-status-offline {
    background: rgba(30, 30, 30, 0.50);
    border: 1px solid rgba(163, 170, 196, 0.20);
    color: #5a6480;
}

.sync-badge-icon {
    font-size: 14px;
}

.sync-badge-text {
    font-size: 10px;
    font-weight: 600;
}

/* Secciones del panel */
.sync-panel__section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sync-panel__section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a3aac4;
    margin: 0 0 4px 0;
}

/* Tarjeta de estado */
.sync-panel__status-card {
    background: rgba(15, 25, 48, 0.50);
    border: 1px solid rgba(129, 233, 255, 0.08);
    border-radius: 10px;
    padding: 12px;
}

.sync-status-display {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sync-status-display.sync-status-pending .sync-status-icon {
    animation: pulse 2s infinite;
}

.sync-status-display.sync-status-syncing .sync-status-icon {
    animation: spin 1s linear infinite;
}

.sync-status-icon {
    font-size: 24px;
    color: #a3aac4;
}

.sync-status-display.sync-status-idle .sync-status-icon,
.sync-status-display.sync-status-synced .sync-status-icon {
    color: #81e9ff;
}

.sync-status-display.sync-status-pending .sync-status-icon {
    color: #69f6b8;
}

.sync-status-display.sync-status-syncing .sync-status-icon {
    color: #81e9ff;
}

.sync-status-display.sync-status-error .sync-status-icon {
    color: #ff716c;
}

.sync-status-display.sync-status-offline .sync-status-icon {
    color: #5a6480;
}

.sync-status-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sync-status-label {
    font-size: 13px;
    font-weight: 600;
    color: #dee5ff;
}

.sync-status-detail {
    font-size: 11px;
    color: #a3aac4;
}

/* Botones de acción */
.sync-panel__actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sync-panel__action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.sync-panel__action .material-symbols-outlined {
    font-size: 18px;
}

.sync-panel__action--primary {
    background: rgba(129, 233, 255, 0.12);
    border-color: rgba(129, 233, 255, 0.25);
    color: #81e9ff;
}

.sync-panel__action--primary:hover:not(:disabled) {
    background: rgba(129, 233, 255, 0.20);
    border-color: rgba(129, 233, 255, 0.40);
    color: #81e9ff;
}

.sync-panel__action--primary:active:not(:disabled) {
    transform: scale(0.98);
}

.sync-panel__action--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sync-panel__action--secondary {
    background: rgba(15, 25, 48, 0.50);
    border-color: rgba(129, 233, 255, 0.08);
    color: #a3aac4;
}

.sync-panel__action--secondary:hover:not(:disabled) {
    background: rgba(129, 233, 255, 0.08);
    border-color: rgba(129, 233, 255, 0.20);
    color: #81e9ff;
}

.sync-panel__action--secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Lista de información */
.sync-panel__info-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sync-panel__info-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(15, 25, 48, 0.50);
    border-radius: 6px;
}

.sync-info-label {
    font-size: 11px;
    color: #a3aac4;
    font-weight: 500;
}

.sync-info-value {
    font-size: 11px;
    color: #dee5ff;
    font-weight: 600;
}

.sync-info-error {
    color: #ff716c;
}

/* Feedback */
.sync-panel__feedback {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sync-panel__feedback--success {
    background: rgba(35, 60, 60, 0.95);
    border: 1px solid rgba(105, 246, 184, 0.40);
    color: #69f6b8;
}

.sync-panel__feedback--error {
    background: rgba(80, 20, 20, 0.95);
    border: 1px solid rgba(255, 113, 108, 0.40);
    color: #ff716c;
}

.sync-panel__feedback--info {
    background: rgba(0, 105, 119, 0.95);
    border: 1px solid rgba(129, 233, 255, 0.40);
    color: #81e9ff;
}

.sync-panel__feedback[style*="display: none"] {
    display: none !important;
}

/* ── Animaciones ─────────────────────────────────────────────────────────────── */

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

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

/* ── Light mode ───────────────────────────────────────────────────────────────── */

html.light .sync-indicator {
    background: rgba(240, 244, 251, 0.95);
    border-color: rgba(0, 105, 119, 0.12);
    color: #44475a;
}

html.light .sync-indicator:hover {
    background: rgba(0, 105, 119, 0.08);
    border-color: rgba(0, 105, 119, 0.25);
    color: #006977;
}

html.light .sync-indicator.sync-status-idle {
    background: rgba(240, 244, 251, 0.95);
    border-color: rgba(0, 105, 119, 0.12);
    color: #44475a;
}

html.light .sync-indicator.sync-status-pending {
    background: rgba(0, 108, 73, 0.20);
    border-color: rgba(0, 108, 73, 0.40);
    color: #006c49;
}

html.light .sync-indicator.sync-status-syncing {
    background: rgba(0, 105, 119, 0.20);
    border-color: rgba(0, 105, 119, 0.40);
    color: #006977;
}

html.light .sync-indicator.sync-status-synced {
    background: rgba(35, 60, 60, 0.20);
    border-color: rgba(0, 108, 73, 0.40);
    color: #006c49;
}

html.light .sync-indicator.sync-status-error {
    background: rgba(186, 26, 26, 0.20);
    border-color: rgba(186, 26, 26, 0.40);
    color: #ba1a1a;
}

html.light .sync-indicator.sync-status-offline {
    background: rgba(232, 232, 232, 0.95);
    border-color: rgba(136, 142, 168, 0.20);
    color: #888ea8;
}

html.light .sync-button {
    background: rgba(0, 105, 119, 0.08);
    border-color: rgba(0, 105, 119, 0.15);
    color: #006977;
}

html.light .sync-button:hover:not(:disabled) {
    background: rgba(0, 105, 119, 0.15);
    border-color: rgba(0, 105, 119, 0.30);
    color: #006977;
}

html.light .sync-panel__status-badge.sync-status-idle {
    background: rgba(240, 244, 251, 0.95);
    border-color: rgba(0, 105, 119, 0.12);
    color: #44475a;
}

html.light .sync-panel__status-badge.sync-status-pending {
    background: rgba(0, 108, 73, 0.20);
    border-color: rgba(0, 108, 73, 0.40);
    color: #006c49;
}

html.light .sync-panel__status-badge.sync-status-syncing {
    background: rgba(0, 105, 119, 0.20);
    border-color: rgba(0, 105, 119, 0.40);
    color: #006977;
}

html.light .sync-panel__status-badge.sync-status-synced {
    background: rgba(35, 60, 60, 0.20);
    border-color: rgba(0, 108, 73, 0.40);
    color: #006c49;
}

html.light .sync-panel__status-badge.sync-status-error {
    background: rgba(186, 26, 26, 0.20);
    border-color: rgba(186, 26, 26, 0.40);
    color: #ba1a1a;
}

html.light .sync-panel__status-badge.sync-status-offline {
    background: rgba(232, 232, 232, 0.95);
    border-color: rgba(136, 142, 168, 0.20);
    color: #888ea8;
}

html.light .sync-panel__status-card {
    background: rgba(232, 238, 248, 0.85);
    border-color: rgba(0, 105, 119, 0.12);
}

html.light .sync-status-detail {
    color: #44475a;
}

html.light .sync-panel__action--primary {
    background: rgba(0, 105, 119, 0.12);
    border-color: rgba(0, 105, 119, 0.25);
    color: #006977;
}

html.light .sync-panel__action--primary:hover:not(:disabled) {
    background: rgba(0, 105, 119, 0.20);
    border-color: rgba(0, 105, 119, 0.40);
    color: #006977;
}

html.light .sync-panel__action--secondary {
    background: rgba(232, 238, 248, 0.85);
    border-color: rgba(0, 105, 119, 0.12);
    color: #44475a;
}

html.light .sync-panel__action--secondary:hover:not(:disabled) {
    background: rgba(0, 105, 119, 0.08);
    border-color: rgba(0, 105, 119, 0.20);
    color: #006977;
}

html.light .sync-panel__info-item {
    background: rgba(232, 238, 248, 0.85);
}

html.light .sync-info-label {
    color: #44475a;
}

html.light .sync-info-value {
    color: #1a1c2e;
}

html.light .sync-info-error {
    color: #ba1a1a;
}
